4d15f90825c18b4e35ca8ea784b5e67076999f2e
[platform/upstream/libzypp.git] / zypp / repo / cached / ProductImpl.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9
10 #include "zypp/TranslatedText.h"
11 #include "zypp/base/String.h"
12 #include "zypp/base/Logger.h"
13 #include "zypp/repo/RepositoryImpl.h"
14 #include "ProductImpl.h"
15 #include "zypp/cache/CacheAttributes.h"
16
17
18 using namespace std;
19 using namespace zypp::detail;
20 using namespace::zypp::repo;
21
22 ///////////////////////////////////////////////////////////////////
23 namespace zypp { namespace repo { namespace cached {
24
25 ///////////////////////////////////////////////////////////////////
26 //
27 //        CLASS NAME : ProductImpl
28 //
29 ///////////////////////////////////////////////////////////////////
30
31 /** Default ctor
32 */
33 ProductImpl::ProductImpl (const data::RecordId &id, cached::RepoImpl::Ptr repository_r)
34     : _repository (repository_r),
35       _id(id)
36 {}
37
38 Repository
39 ProductImpl::repository() const
40 {
41   return _repository->selfRepository();
42 }
43
44 ///////////////////////////////////////////////////
45 // ResObject Attributes
46 ///////////////////////////////////////////////////
47
48 TranslatedText ProductImpl::summary() const
49 {
50   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
51 }
52
53 TranslatedText ProductImpl::description() const
54 {
55   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
56 }
57
58 TranslatedText ProductImpl::insnotify() const
59 {
60   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
61 }
62
63 TranslatedText ProductImpl::delnotify() const
64 {
65   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
66 }
67
68 TranslatedText ProductImpl::licenseToConfirm() const
69 {
70   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
71 }
72
73 Vendor ProductImpl::vendor() const
74 {
75   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
76 }
77
78
79 ByteCount ProductImpl::size() const
80 {
81   return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
82 }
83
84 bool ProductImpl::installOnly() const
85 {
86   return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
87 }
88
89 Date ProductImpl::buildtime() const
90 {
91   return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
92 }
93
94 Date ProductImpl::installtime() const
95 {
96   return Date();
97 }
98
99 //////////////////////////////////////////
100 // PRODUCT
101 /////////////////////////////////////////
102
103 std::string ProductImpl::type() const
104 {
105   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductType() );
106 }
107
108 Url ProductImpl::releaseNotesUrl() const
109 {
110   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductReleasenotesUrl() );
111 }
112
113 std::list<Url> ProductImpl::updateUrls() const
114 {
115   std::list<Url> urls;
116   _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductUpdateUrls(), back_inserter(urls) );
117   return urls;
118 }
119
120 std::list<Url> ProductImpl::extraUrls() const
121 {
122   std::list<Url> urls;
123   _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductExtraUrls(), back_inserter(urls) );
124   return urls;
125 }
126
127 std::list<Url> ProductImpl::optionalUrls() const
128 {
129   std::list<Url> urls;
130   _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductOptionalUrls(), back_inserter(urls) );
131   return urls;
132 }
133
134 list<string> ProductImpl::flags() const
135 {
136   list<string> flags;
137   _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductFlags(), back_inserter(flags) );
138   return flags;
139 }
140
141 TranslatedText ProductImpl::shortName() const
142 {
143   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrProductShortName() );
144 }
145
146 std::string ProductImpl::distributionName() const
147 {
148   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionName() );
149 }
150
151 Edition ProductImpl::distributionEdition() const
152 {
153   return Edition( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionEdition() ) );
154 }
155
156 /////////////////////////////////////////////////////////////////
157 } } } // namespace zypp::repo::cached
158 ///////////////////////////////////////////////////////////////////
159