/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataEntryAnalyticsAccount.m

http://macfuse.googlecode.com/ · Objective C · 147 lines · 93 code · 37 blank · 17 comment · 1 complexity · 1a98fd150c422eb409038b994f6fcd5b MD5 · raw file

  1. /* Copyright (c) 2009 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. //
  16. // GDataEntryAnalyticsAccount.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE
  19. #import "GDataEntryAnalyticsAccount.h"
  20. #import "GDataAnalyticsConstants.h"
  21. #import "GDataAnalyticsElements.h"
  22. @implementation GDataEntryAnalyticsAccount
  23. + (GDataEntryAnalyticsAccount *)accountEntry {
  24. GDataEntryAnalyticsAccount *obj;
  25. obj = [self object];
  26. [obj setNamespaces:[GDataAnalyticsConstants analyticsNamespaces]];
  27. return obj;
  28. }
  29. #pragma mark -
  30. + (NSString *)standardKindAttributeValue {
  31. return @"analytics#account";
  32. }
  33. + (void)load {
  34. [self registerEntryClass];
  35. }
  36. - (void)addExtensionDeclarations {
  37. [super addExtensionDeclarations];
  38. [self addExtensionDeclarationForParentClass:[self class]
  39. childClasses:
  40. [GDataAnalyticsProperty class],
  41. [GDataAnalyticsTableID class],
  42. [GDataAnalyticsGoal class],
  43. [GDataAnalyticsCustomVariable class],
  44. nil];
  45. }
  46. #if !GDATA_SIMPLE_DESCRIPTIONS
  47. - (NSMutableArray *)itemsForDescription {
  48. NSArray *props = [self analyticsProperties];
  49. NSString *propsDescValue;
  50. propsDescValue = [GDataAnalyticsProperty descriptionItemForProperties:props];
  51. struct GDataDescriptionRecord descRecs[] = {
  52. { @"tableID", @"tableID", kGDataDescValueLabeled },
  53. { @"properties", propsDescValue, kGDataDescValueIsKeyPath },
  54. { nil, nil, (GDataDescRecTypes)0 }
  55. };
  56. NSMutableArray *items = [super itemsForDescription];
  57. [self addDescriptionRecords:descRecs toItems:items];
  58. return items;
  59. }
  60. #endif
  61. + (NSString *)defaultServiceVersion {
  62. return kGDataAnalyticsDefaultServiceVersion;
  63. }
  64. #pragma mark -
  65. - (NSString *)tableID {
  66. GDataAnalyticsTableID *obj;
  67. obj = [self objectForExtensionClass:[GDataAnalyticsTableID class]];
  68. return [obj stringValue];
  69. }
  70. - (void)setTableID:(NSString *)str {
  71. GDataAnalyticsTableID *obj = [GDataAnalyticsTableID valueWithString:str];
  72. [self setObject:obj forExtensionClass:[GDataAnalyticsTableID class]];
  73. }
  74. - (NSArray *)analyticsProperties {
  75. return [self objectsForExtensionClass:[GDataAnalyticsProperty class]];
  76. }
  77. - (void)setAnalyticsProperties:(NSArray *)array {
  78. [self setObjects:array forExtensionClass:[GDataAnalyticsProperty class]];
  79. }
  80. - (void)addAnalyticsProperty:(GDataAnalyticsProperty *)obj {
  81. [self addObject:obj forExtensionClass:[GDataAnalyticsProperty class]];
  82. }
  83. - (NSArray *)goals {
  84. return [self objectsForExtensionClass:[GDataAnalyticsGoal class]];
  85. }
  86. - (void)setGoals:(NSArray *)array {
  87. [self setObjects:array forExtensionClass:[GDataAnalyticsGoal class]];
  88. }
  89. - (void)addGoal:(GDataAnalyticsGoal *)obj {
  90. [self addObject:obj forExtensionClass:[GDataAnalyticsGoal class]];
  91. }
  92. - (NSArray *)customVariables {
  93. return [self objectsForExtensionClass:[GDataAnalyticsCustomVariable class]];
  94. }
  95. - (void)setCustomVariables:(NSArray *)array {
  96. [self setObjects:array forExtensionClass:[GDataAnalyticsCustomVariable class]];
  97. }
  98. - (void)addCustomVariable:(GDataAnalyticsCustomVariable *)obj {
  99. [self addObject:obj forExtensionClass:[GDataAnalyticsCustomVariable class]];
  100. }
  101. #pragma mark -
  102. - (GDataAnalyticsProperty *)analyticsPropertyWithName:(NSString *)name {
  103. NSArray *array = [self analyticsProperties];
  104. GDataAnalyticsProperty *obj = [GDataUtilities firstObjectFromArray:array
  105. withValue:name
  106. forKeyPath:@"name"];
  107. return obj;
  108. }
  109. @end
  110. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE