/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataEntryAnalyticsAccount.m
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// 17// GDataEntryAnalyticsAccount.m 18// 19 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE 21 22#import "GDataEntryAnalyticsAccount.h" 23#import "GDataAnalyticsConstants.h" 24#import "GDataAnalyticsElements.h" 25 26@implementation GDataEntryAnalyticsAccount 27 28+ (GDataEntryAnalyticsAccount *)accountEntry { 29 30 GDataEntryAnalyticsAccount *obj; 31 obj = [self object]; 32 33 [obj setNamespaces:[GDataAnalyticsConstants analyticsNamespaces]]; 34 35 return obj; 36} 37 38#pragma mark - 39 40+ (NSString *)standardKindAttributeValue { 41 return @"analytics#account"; 42} 43 44+ (void)load { 45 [self registerEntryClass]; 46} 47 48- (void)addExtensionDeclarations { 49 [super addExtensionDeclarations]; 50 51 [self addExtensionDeclarationForParentClass:[self class] 52 childClasses: 53 [GDataAnalyticsProperty class], 54 [GDataAnalyticsTableID class], 55 [GDataAnalyticsGoal class], 56 [GDataAnalyticsCustomVariable class], 57 nil]; 58} 59 60#if !GDATA_SIMPLE_DESCRIPTIONS 61- (NSMutableArray *)itemsForDescription { 62 63 NSArray *props = [self analyticsProperties]; 64 NSString *propsDescValue; 65 propsDescValue = [GDataAnalyticsProperty descriptionItemForProperties:props]; 66 67 struct GDataDescriptionRecord descRecs[] = { 68 { @"tableID", @"tableID", kGDataDescValueLabeled }, 69 { @"properties", propsDescValue, kGDataDescValueIsKeyPath }, 70 { nil, nil, (GDataDescRecTypes)0 } 71 }; 72 73 NSMutableArray *items = [super itemsForDescription]; 74 [self addDescriptionRecords:descRecs toItems:items]; 75 return items; 76} 77#endif 78 79+ (NSString *)defaultServiceVersion { 80 return kGDataAnalyticsDefaultServiceVersion; 81} 82 83#pragma mark - 84 85- (NSString *)tableID { 86 GDataAnalyticsTableID *obj; 87 88 obj = [self objectForExtensionClass:[GDataAnalyticsTableID class]]; 89 return [obj stringValue]; 90} 91 92- (void)setTableID:(NSString *)str { 93 GDataAnalyticsTableID *obj = [GDataAnalyticsTableID valueWithString:str]; 94 [self setObject:obj forExtensionClass:[GDataAnalyticsTableID class]]; 95} 96 97 98- (NSArray *)analyticsProperties { 99 return [self objectsForExtensionClass:[GDataAnalyticsProperty class]]; 100} 101 102- (void)setAnalyticsProperties:(NSArray *)array { 103 [self setObjects:array forExtensionClass:[GDataAnalyticsProperty class]]; 104} 105 106- (void)addAnalyticsProperty:(GDataAnalyticsProperty *)obj { 107 [self addObject:obj forExtensionClass:[GDataAnalyticsProperty class]]; 108} 109 110 111- (NSArray *)goals { 112 return [self objectsForExtensionClass:[GDataAnalyticsGoal class]]; 113} 114 115- (void)setGoals:(NSArray *)array { 116 [self setObjects:array forExtensionClass:[GDataAnalyticsGoal class]]; 117} 118 119- (void)addGoal:(GDataAnalyticsGoal *)obj { 120 [self addObject:obj forExtensionClass:[GDataAnalyticsGoal class]]; 121} 122 123- (NSArray *)customVariables { 124 return [self objectsForExtensionClass:[GDataAnalyticsCustomVariable class]]; 125} 126 127- (void)setCustomVariables:(NSArray *)array { 128 [self setObjects:array forExtensionClass:[GDataAnalyticsCustomVariable class]]; 129} 130 131- (void)addCustomVariable:(GDataAnalyticsCustomVariable *)obj { 132 [self addObject:obj forExtensionClass:[GDataAnalyticsCustomVariable class]]; 133} 134 135#pragma mark - 136 137- (GDataAnalyticsProperty *)analyticsPropertyWithName:(NSString *)name { 138 NSArray *array = [self analyticsProperties]; 139 GDataAnalyticsProperty *obj = [GDataUtilities firstObjectFromArray:array 140 withValue:name 141 forKeyPath:@"name"]; 142 return obj; 143} 144 145@end 146 147#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE