PageRenderTime 56ms CodeModel.GetById 8ms app.highlight 44ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 113 lines | 69 code | 27 blank | 17 comment | 1 complexity | 5f23f59ce2bf6b8e5efefa288bb1d2c2 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//  GDataAnalyticsDataSource.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE
 21
 22#import "GDataAnalyticsDataSource.h"
 23
 24#import "GDataAnalyticsConstants.h"
 25#import "GDataAnalyticsElements.h"
 26#import "GDataUtilities.h"
 27
 28@implementation GDataAnalyticsDataSource
 29
 30+ (NSString *)extensionElementURI       { return kGDataNamespaceAnalyticsDXP; }
 31+ (NSString *)extensionElementPrefix    { return kGDataNamespaceAnalyticsDXPPrefix; }
 32+ (NSString *)extensionElementLocalName { return @"dataSource"; }
 33
 34- (void)addExtensionDeclarations {
 35  [super addExtensionDeclarations];
 36
 37  [self addExtensionDeclarationForParentClass:[self class]
 38                                 childClasses:
 39   [GDataAnalyticsProperty class],
 40   [GDataAnalyticsTableID class],
 41   [GDataAnalyticsTableName class],
 42   nil];
 43}
 44
 45#if !GDATA_SIMPLE_DESCRIPTIONS
 46- (NSMutableArray *)itemsForDescription {
 47
 48  static struct GDataDescriptionRecord descRecs[] = {
 49    { @"tableID",    @"tableID",    kGDataDescValueLabeled },
 50    { @"tableName",  @"tableName",  kGDataDescValueLabeled },
 51    { @"properties", @"properties", kGDataDescArrayDescs   },
 52    { nil, nil, (GDataDescRecTypes)0 }
 53  };
 54
 55  NSMutableArray *items = [super itemsForDescription];
 56  [self addDescriptionRecords:descRecs toItems:items];
 57  return items;
 58}
 59#endif
 60
 61#pragma mark -
 62
 63- (NSString *)tableID {
 64  GDataAnalyticsTableID *obj;
 65
 66  obj = [self objectForExtensionClass:[GDataAnalyticsTableID class]];
 67  return [obj stringValue];
 68}
 69
 70- (void)setTableID:(NSString *)str {
 71  GDataAnalyticsTableID *obj = [GDataAnalyticsTableID valueWithString:str];
 72  [self setObject:obj forExtensionClass:[GDataAnalyticsTableID class]];
 73}
 74
 75
 76- (NSString *)tableName {
 77  GDataAnalyticsTableName *obj;
 78
 79  obj = [self objectForExtensionClass:[GDataAnalyticsTableName class]];
 80  return [obj stringValue];
 81}
 82
 83- (void)setTableName:(NSString *)str {
 84  GDataAnalyticsTableName *obj = [GDataAnalyticsTableName valueWithString:str];
 85  [self setObject:obj forExtensionClass:[GDataAnalyticsTableName class]];
 86}
 87
 88
 89- (NSArray *)analyticsProperties {
 90  return [self objectsForExtensionClass:[GDataAnalyticsProperty class]];
 91}
 92
 93- (void)setAnalyticsProperties:(NSArray *)array {
 94  [self setObjects:array forExtensionClass:[GDataAnalyticsProperty class]];
 95}
 96
 97- (void)addAnalyticsProperty:(GDataAnalyticsProperty *)obj {
 98  [self addObject:obj forExtensionClass:[GDataAnalyticsProperty class]];
 99}
100
101#pragma mark -
102
103- (GDataAnalyticsProperty *)analyticsPropertyWithName:(NSString *)name {
104  NSArray *array = [self analyticsProperties];
105  GDataAnalyticsProperty *obj = [GDataUtilities firstObjectFromArray:array
106                                                           withValue:name
107                                                          forKeyPath:@"name"];
108  return obj;
109}
110
111@end
112
113#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE