00001 /*------------------------------------------------------------------------------ 00002 Name: UnSubscribeKey.cpp 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 ------------------------------------------------------------------------------*/ 00006 00007 #include <client/key/UnSubscribeKey.h> 00008 #include <util/Global.h> 00009 00010 using namespace std; 00011 using namespace org::xmlBlaster::util; 00012 using namespace org::xmlBlaster::util::key; 00013 00014 namespace org { namespace xmlBlaster { namespace client { namespace key { 00015 00016 UnSubscribeKey::UnSubscribeKey(Global& global) 00017 : ME("UnSubscribeKey"), global_(global), log_(global_.getLog("org.xmlBlaster.client")), queryKeyData_(global_) 00018 { 00019 } 00020 00021 UnSubscribeKey::UnSubscribeKey(Global& global, const string& query, const string& queryType) 00022 : ME("UnSubscribeKey"), global_(global), log_(global_.getLog("org.xmlBlaster.client")), 00023 queryKeyData_(global_, query, queryType) 00024 { 00025 } 00026 00027 UnSubscribeKey::UnSubscribeKey(Global& global, const QueryKeyData& data) 00028 : ME("UnSubscribeKey"), global_(global), log_(global_.getLog("org.xmlBlaster.client")), queryKeyData_(data) 00029 { 00030 } 00031 00032 UnSubscribeKey::UnSubscribeKey(const UnSubscribeKey& key) 00033 : ME(key.ME), global_(key.global_), log_(key.log_), queryKeyData_(key.queryKeyData_) 00034 { 00035 } 00036 00037 UnSubscribeKey& UnSubscribeKey::operator =(const UnSubscribeKey& key) 00038 { 00039 queryKeyData_ = key.queryKeyData_; 00040 return *this; 00041 } 00042 00043 void UnSubscribeKey::setOid(const string& oid) 00044 { 00045 queryKeyData_.setOid(oid); 00046 } 00047 00048 string UnSubscribeKey::getOid() const 00049 { 00050 return queryKeyData_.getOid(); 00051 } 00052 00053 string UnSubscribeKey::getQueryType() const 00054 { 00055 return queryKeyData_.getQueryType(); 00056 } 00057 00058 void UnSubscribeKey::setQueryString(const string& tags) 00059 { 00060 queryKeyData_.setQueryString(tags); 00061 } 00062 00063 string UnSubscribeKey::getQueryString() const 00064 { 00065 return queryKeyData_.getQueryString(); 00066 } 00067 00068 void UnSubscribeKey::setDomain(const string& domain) 00069 { 00070 queryKeyData_.setDomain(domain); 00071 } 00072 00073 string UnSubscribeKey::getDomain() const 00074 { 00075 return queryKeyData_.getDomain(); 00076 } 00077 00078 string UnSubscribeKey::getUrl() const 00079 { 00080 if (string(Constants::EXACT) == getQueryType()) 00081 return Constants::EXACT_URL_PREFIX+getOid(); 00082 else if (string(Constants::XPATH) == getQueryType()) 00083 return Constants::XPATH_URL_PREFIX+getQueryString(); 00084 else if (string(Constants::D_O_M_A_I_N) == getQueryType()) 00085 return Constants::DOMAIN_URL_PREFIX+getDomain(); 00086 //else if (regex) 00087 throw XmlBlasterException(USER_ILLEGALARGUMENT, ME, "getUrl() failed: Unknown query type: " + toXml("")); 00088 } 00089 00090 string UnSubscribeKey::toXml(const string& extraOffset) const 00091 { 00092 return queryKeyData_.toXml(extraOffset); 00093 } 00094 00095 string UnSubscribeKey::wrap(const string& str) 00096 { 00097 queryKeyData_.setQueryString(str); 00098 return queryKeyData_.toXml(); 00099 } 00100 00101 const QueryKeyData& UnSubscribeKey::getData() const 00102 { 00103 return queryKeyData_; 00104 } 00105 00106 }}}} // namespace 00107 00108 00109 00110