File tree Expand file tree Collapse file tree 6 files changed +81
-1
lines changed Expand file tree Collapse file tree 6 files changed +81
-1
lines changed Original file line number Diff line number Diff line change 13
13
#include " netlicensing/token.h"
14
14
#include " netlicensing/transaction.h"
15
15
#include " netlicensing/licensing_model.h"
16
+ #include " netlicensing/license_type.h"
16
17
17
18
namespace netlicensing {
18
19
@@ -134,6 +135,13 @@ namespace netlicensing {
134
135
return params;
135
136
}
136
137
138
+ template <>
139
+ inline parameters_type toParametersList<LicenseType>(LicenseType value) {
140
+ parameters_type params;
141
+ params.push_back (std::make_pair (NAME, value.getName ()));
142
+ return params;
143
+ }
144
+
137
145
} // namespace netlicensing
138
146
139
147
#endif // __CONVERTERS_H__
Original file line number Diff line number Diff line change
1
+ #ifndef __LICENSE_TYPES_H__
2
+ #define __LICENSE_TYPES_H__
3
+
4
+ #include < list>
5
+
6
+ #include " netlicensing/entity.h"
7
+
8
+ namespace netlicensing {
9
+
10
+ class LicenseType {
11
+ private:
12
+ String_t name_i;
13
+
14
+ public:
15
+ LicenseType () : name_i() { }
16
+
17
+ void setName (const String_t& name) {
18
+ name_i = name;
19
+ }
20
+
21
+ const String_t& getName () const {
22
+ return name_i;
23
+ }
24
+
25
+ String_t toString () const {
26
+ std::string name (this ->getName ());
27
+
28
+ std::stringstream ss;
29
+ ss << " LicenseType [" ;
30
+ ss << " name: " ;
31
+ ss << name;
32
+ ss << " ]" ;
33
+ return ss.str ();
34
+ }
35
+
36
+ };
37
+
38
+ }
39
+
40
+ #endif // __LICENSE_TYPES_H__
Original file line number Diff line number Diff line change @@ -260,6 +260,21 @@ namespace netlicensing {
260
260
}
261
261
};
262
262
263
+ class LicenseTypeWrapper : public ItemWrapper {
264
+ LicenseType item_i;
265
+
266
+ public:
267
+ const LicenseType& getItem () {
268
+ return item_i;
269
+ }
270
+
271
+ virtual void addProperty (const std::string& key, const std::string& value) {
272
+ if (key == " name" ) {
273
+ item_i.setName (value);
274
+ }
275
+ }
276
+ };
277
+
263
278
class PaymentMethodWrapper : public ItemWrapper {
264
279
PaymentMethod item_i;
265
280
@@ -376,6 +391,12 @@ namespace netlicensing {
376
391
static std::string getType () { return " LicensingModelProperties" ; }
377
392
};
378
393
394
+ template <>
395
+ struct ItemTraits <LicenseType> {
396
+ typedef LicenseTypeWrapper Wrapper_t;
397
+ static std::string getType () { return " LicenseType" ; }
398
+ };
399
+
379
400
template <>
380
401
struct ItemTraits <PaymentMethod> {
381
402
typedef PaymentMethodWrapper Wrapper_t;
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ class UtilityService {
106
106
public:
107
107
static std::list<Country> listCountries (Context& ctx);
108
108
static std::list<LicensingModel> listLicensingModels (Context& ctx);
109
- // static std::list<Product > listLicenseTypes(Context& ctx);
109
+ static std::list<LicenseType > listLicenseTypes (Context& ctx);
110
110
};
111
111
112
112
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ template<> inline std::string endpoint<Token>() { return std::string("token"); }
18
18
template <> inline std::string endpoint<Transaction>() { return std::string (" transaction" ); }
19
19
template <> inline std::string endpoint<Country>() { return std::string (" utility/countries" ); }
20
20
template <> inline std::string endpoint<LicensingModel>() { return std::string (" utility/licensingModels" ); }
21
+ template <> inline std::string endpoint<LicenseType>() { return std::string (" utility/licenseTypes" ); }
21
22
22
23
template <typename M>
23
24
void getEntity (Context& ctx, M& mapper, const std::string& number) {
Original file line number Diff line number Diff line change @@ -531,4 +531,14 @@ namespace netlicensing {
531
531
netlicensing::list (ctx, licensingModelsMapper, " " );
532
532
return licensingModelsMapper.getItems ();
533
533
}
534
+
535
+ /* *
536
+ * Returns all license types. See NetLicensingAPI for details:
537
+ * https://www.labs64.de/confluence/display/NLICPUB/Utility+Services#UtilityServices-LicenseTypeslist
538
+ */
539
+ std::list<LicenseType> UtilityService::listLicenseTypes (Context& ctx) {
540
+ StandardMapper<LicenseType> licenseTypeMapper;
541
+ netlicensing::list (ctx, licenseTypeMapper, " " );
542
+ return licenseTypeMapper.getItems ();
543
+ }
534
544
}
You can’t perform that action at this time.
0 commit comments