PageRenderTime 185ms CodeModel.GetById 155ms app.highlight 27ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 125 lines | 77 code | 31 blank | 17 comment | 1 complexity | 3c072836a37b33e20e03f6e813e3f321 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//  GDataEntryAnalyticsData.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE
 21
 22#import "GDataEntryAnalyticsData.h"
 23#import "GDataAnalyticsConstants.h"
 24#import "GDataAnalyticsElements.h"
 25#import "GDataAnalyticsMetric.h"
 26
 27@implementation GDataEntryAnalyticsData
 28
 29+ (GDataEntryAnalyticsData *)dataEntry {
 30
 31  GDataEntryAnalyticsData *obj;
 32  obj = [self object];
 33
 34  [obj setNamespaces:[GDataAnalyticsConstants analyticsNamespaces]];
 35
 36  return obj;
 37}
 38
 39#pragma mark -
 40
 41+ (NSString *)standardKindAttributeValue {
 42  return @"analytics#datarow";
 43}
 44
 45+ (void)load {
 46  [self registerEntryClass];
 47}
 48
 49- (void)addExtensionDeclarations {
 50  [super addExtensionDeclarations];
 51
 52  [self addExtensionDeclarationForParentClass:[self class]
 53                                 childClasses:
 54   [GDataAnalyticsDimension class],
 55   [GDataAnalyticsMetric class],
 56   nil];
 57}
 58
 59#if !GDATA_SIMPLE_DESCRIPTIONS
 60- (NSMutableArray *)itemsForDescription {
 61
 62  static struct GDataDescriptionRecord descRecs[] = {
 63    { @"metrics",    @"metrics",    kGDataDescArrayDescs },
 64    { @"dimensions", @"dimensions", kGDataDescArrayDescs },
 65    { nil, nil, (GDataDescRecTypes)0 }
 66  };
 67
 68  NSMutableArray *items = [super itemsForDescription];
 69  [self addDescriptionRecords:descRecs toItems:items];
 70  return items;
 71}
 72#endif
 73
 74+ (NSString *)defaultServiceVersion {
 75  return kGDataAnalyticsDefaultServiceVersion;
 76}
 77
 78#pragma mark -
 79
 80- (NSArray *)dimensions {
 81  return [self objectsForExtensionClass:[GDataAnalyticsDimension class]];
 82}
 83
 84- (void)setDimensions:(NSArray *)array {
 85  [self setObjects:array forExtensionClass:[GDataAnalyticsDimension class]];
 86}
 87
 88- (void)addDimension:(GDataAnalyticsDimension *)obj {
 89  [self addObject:obj forExtensionClass:[GDataAnalyticsDimension class]];
 90}
 91
 92- (GDataAnalyticsDimension *)dimensionWithName:(NSString *)name {
 93  NSArray *array = [self dimensions];
 94
 95  GDataAnalyticsDimension *obj = [GDataUtilities firstObjectFromArray:array
 96                                                            withValue:name
 97                                                           forKeyPath:@"name"];
 98  return obj;
 99}
100
101
102- (NSArray *)metrics {
103  return [self objectsForExtensionClass:[GDataAnalyticsMetric class]];
104}
105
106- (void)setMetrics:(NSArray *)array {
107  [self setObjects:array forExtensionClass:[GDataAnalyticsMetric class]];
108}
109
110- (void)addMetric:(GDataAnalyticsMetric *)obj {
111  [self addObject:obj forExtensionClass:[GDataAnalyticsMetric class]];
112}
113
114- (GDataAnalyticsMetric *)metricWithName:(NSString *)name {
115  NSArray *array = [self metrics];
116
117  GDataAnalyticsMetric *obj = [GDataUtilities firstObjectFromArray:array
118                                                         withValue:name
119                                                        forKeyPath:@"name"];
120  return obj;
121}
122
123@end
124
125#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE