00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _CONTRACTGW_H_
00035 #define _CONTRACTGW_H_
00036
00037
00038
00039
00040
00041
00042 #include "anclist.h"
00043 #include "osbid.h"
00044 #include "osbconst.h"
00045 #include "contract.h"
00046
00047
00048
00049 namespace OSB_DB {
00050 class Session;
00051 }
00052
00053
00054
00055 namespace OSB_DB {
00056
00057
00058
00062 class ContractGw {
00064 friend class OSB_LIB::Contract;
00066 friend class OSB_LIB::PersProduct;
00067
00069 ContractGw(const ContractGw& rhs);
00071 ContractGw& operator=(const ContractGw& rhs);
00072 public:
00074 typedef OSB_LIB::Id<OSB_LIB::Contract> ContractId;
00076 typedef std::map<ContractId, OSB_LIB::Contract> ContractList;
00078 typedef std::set<ContractId> ContractIds;
00079 public:
00080 ContractGw() {}
00081
00094 bool fetch(
00095 const Session& session,
00096 OSB_LIB::Contract& co
00097 );
00098
00112 long fetch(
00113 const Session& session,
00114 const OSB_LIB::Associate::Oid& asId,
00115 ContractList& dest
00116 );
00117
00126 long fetch(
00127 const Session& session,
00128 const OSB_LIB::Associate::Oid& asId,
00129 ContractIds& idList
00130 );
00131
00132 private:
00147 bool insContract(
00148 const Session& session,
00149 OSB_LIB::Contract& co
00150 );
00151
00168 bool delContract(
00169 const Session& session,
00170 const OSB_LIB::Contract& co
00171 );
00172
00190 bool updContract(
00191 const Session& session,
00192 const OSB_LIB::Contract& co
00193 );
00194
00203 bool incObjVs(
00204 const Session& session,
00205 OSB_LIB::Contract& co
00206 );
00207
00208 private:
00217 bool setPrefStatus(
00218 const Session& session,
00219 const OSB_LIB::Contract& co
00220 );
00221
00230 bool setEffStatus(
00231 const Session& session,
00232 const OSB_LIB::Contract& co
00233 );
00234
00242 void storeRequest(
00243 const Session& session,
00244 const OSB_LIB::Contract::Oid& coId,
00245 OSB_LIB::StatusRequest& status
00246 );
00247
00255 void storeChange(
00256 const Session& session,
00257 const OSB_LIB::Contract::Oid& coId,
00258 OSB_LIB::StatusChange& change
00259 );
00260
00270 OSB_LIB::ObjectStatus lock(
00271 const Session& session,
00272 const OSB_LIB::Contract::Oid& coId,
00273 bool noWait
00274 );
00275
00284 OSB_LIB::ObjectStatus lock(
00285 const Session& session,
00286 const OSB_LIB::Contract& co,
00287 bool noWait
00288 );
00289
00299 void lockPersProducts(
00300 const Session& session,
00301 const OSB_LIB::Contract::Oid& coId,
00302 bool noWait
00303 );
00304 };
00305 }
00306 #endif // #ifndef _CONTRACTGW_H_