00001 // OSB library ********************************************* -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.28 $ 00012 00013 License 00014 OSB rating and billing library for communication networks 00015 Copyright (C) 2004, 2005, 2006 OSB systems 00016 00017 This file may be distributed and/or modify under the terms of the 00018 GNU General Public License (GPL) as published by the Free Software 00019 Foundation which is provided in the file LICENSE.GPL included in the 00020 packaging of this file. 00021 00022 The file is distributed in the hope that it will be useful, but WITHOUT 00023 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00024 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00025 for more details. 00026 00027 Holders of a OSB Commercial License may use this file under the terms 00028 and conditions of this commercial license. 00029 */ 00030 #ifndef _CALLINGCARD_H_ 00031 #define _CALLINGCARD_H_ 00032 00033 // ********************************************************************* 00034 // included header files 00035 // + standard includes 00036 #include <string> 00037 00038 // + local headers 00039 #include "resource.h" 00040 #include "resourceitem.h" 00041 00042 // ********************************************************************* 00043 // class declarations 00044 namespace OSB_DB { 00045 class Session; 00046 class CallingCardGw; 00047 } 00048 00049 // ********************************************************************* 00050 // namespace extensions 00051 namespace OSB_LIB { 00052 00053 // ********************************************************************* 00054 // type definitions 00055 00056 // ********************************************************************* 00057 // class definitions 00058 00059 // ***************************************************************** 00060 // class CallingCard 00064 class CallingCard : public Resource { 00066 friend class OSB_DB::CallingCardGw; 00067 00069 static const Type typeId_ = rtCallingCard; 00070 public: 00077 typedef std::string SerialNumber; 00078 00079 public: 00081 CallingCard(const Oid& oid = Oid()); 00089 explicit CallingCard( 00090 const Number& rn, 00091 const Id<Network>& nw = Id<Network>() 00092 ); 00099 CallingCard( 00100 const Number& rn, 00101 const Id2<NetworkElement>& ne 00102 ); 00103 00104 00105 // Documentation from base class. 00106 Type typeId() const; 00107 00109 00110 00111 const std::string& serialNumber() const; 00113 00114 private: 00116 bool read( 00117 const OSB_DB::Session& session 00118 ); 00119 00121 bool insert( 00122 const OSB_DB::Session &session 00123 ); 00124 00126 void updData( 00127 const OSB_DB::Session &session 00128 ); 00129 00131 bool remove( 00132 const OSB_DB::Session &session 00133 ); 00134 00135 protected: 00137 SerialNumber serialNumber_; 00138 }; // class CallingCard 00139 00143 class PersCallingCard : public PersResource { 00144 friend class OSB_DB::CallingCardGw; 00145 public: 00147 static const Type type_; 00148 // Documentation from base class. 00149 typedef std::auto_ptr<PersCallingCard> AutoPtr; 00150 00151 public: 00153 PersCallingCard(const Oid& oid = Oid()); 00155 PersCallingCard(const PersCallingCard& rhs); 00157 PersCallingCard& operator=(const PersCallingCard& rhs); 00159 ~PersCallingCard(); 00160 00161 public: 00162 // Documentation from base class. 00163 AutoPtr clone() const; 00164 Type type() const { return type_; } 00165 00167 bool canConfig() const; 00168 00169 00170 // Documentation from base class. 00171 const Resource* resource() const; 00172 00174 const Resource* oldResource() const; 00175 00176 private: 00177 // Documentation from base class. 00178 Resource* resource(); 00179 // Documentation from base class. 00180 Resource* oldResource(); 00181 00182 // Documentation from base class. 00183 Resource* createResource( 00184 const Resource::Oid& resourceId 00185 ); 00186 00188 void assign(const CallingCard& rhs); 00189 00190 private: 00191 // Documentation from base class. 00192 PersProductItem* clone_() const; 00193 00209 bool readSpecific( 00210 const OSB_DB::Session& session 00211 ); 00212 00213 bool insSpecific( 00214 const OSB_DB::Session& session 00215 ); 00216 00217 bool updSpecific( 00218 const OSB_DB::Session& session 00219 ); 00220 00221 bool delSpecific( 00222 const OSB_DB::Session& session 00223 ); 00225 00226 private: 00227 CallingCard* callingCard_; 00229 CallingCard* oldCallingCard_; 00230 }; // class PersCallingCard 00231 00238 class CallingCardItem : public ResourceItem { 00239 public: 00241 static const Type type_; 00242 // Documentation from base class. 00243 typedef std::auto_ptr<CallingCardItem> AutoPtr; 00244 00252 CallingCardItem( 00253 const Oid& oid, 00254 const std::string& name = "", 00255 const std::string& des = "" 00256 ); 00257 00258 public: 00260 Type type() const { return type_; } 00261 // Documentation from base class. 00262 AutoPtr clone() const; 00263 00270 ProductItem::CfgType canConfigure() const; 00271 00278 ProductItem::DefPersType canDefPers() const; 00279 00281 CfgPersType canPersonalize() const; 00282 00284 const PersProductItem* defPersItem() const; 00285 00292 std::auto_ptr<PersProductItem> 00293 crePersProductItem() const; 00294 00295 private: 00296 // Documentation from base class. 00297 ProductItem* clone_() const; 00298 00315 bool readSpecific( 00316 const OSB_DB::Session& session 00317 ); 00318 00325 bool insSpecific( 00326 const OSB_DB::Session& session 00327 ); 00328 00335 bool updSpecific( 00336 const OSB_DB::Session& session 00337 ); 00338 00345 bool delSpecific( 00346 const OSB_DB::Session& session 00347 ); 00349 }; // class CallingCardItem 00350 00351 // ********************************************************************* 00352 // inline definitions 00353 00354 } // namespace OSB_LIB 00355 #endif // #ifndef _CALLINGCARD_H_