PageRenderTime 22ms CodeModel.GetById 1ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Finance/GDataEntryFinancePosition.m

http://macfuse.googlecode.com/
Objective C | 124 lines | 72 code | 35 blank | 17 comment | 3 complexity | 856fdeb230e9652b67425098178d1a3a MD5 | raw file
  1/* Copyright (c) 2008 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//  GDataEntryFinancePosition.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE
 21
 22#import "GDataEntryFinancePosition.h"
 23
 24#import "GDataEntryFinancePortfolio.h" // for namespace and constants
 25
 26@implementation GDataEntryFinancePosition
 27
 28+ (GDataEntryFinancePosition *)positionEntry {
 29  
 30  GDataEntryFinancePosition *obj;
 31  obj = [self object];
 32  
 33  [obj setNamespaces:[GDataEntryFinancePortfolio financeNamespaces]];
 34  
 35  return obj;
 36}
 37
 38#pragma mark -
 39
 40+ (NSString *)standardEntryKind {
 41  return kGDataCategoryFinancePosition;
 42}
 43
 44+ (void)load {
 45  [self registerEntryClass];
 46}
 47
 48- (void)addExtensionDeclarations {
 49  
 50  [super addExtensionDeclarations];
 51  
 52  Class entryClass = [self class];
 53  
 54  [self addExtensionDeclarationForParentClass:entryClass
 55                                 childClasses:
 56   [GDataPositionData class],
 57   [GDataFinanceSymbol class],
 58   [GDataFeedLink class],
 59   nil];  
 60}
 61
 62#if !GDATA_SIMPLE_DESCRIPTIONS
 63- (NSMutableArray *)itemsForDescription {
 64  
 65  NSMutableArray *items = [super itemsForDescription];
 66  
 67  [self addToArray:items objectDescriptionIfNonNil:[self symbol] withName:@"symbol"];
 68  [self addToArray:items objectDescriptionIfNonNil:[self positionData] withName:@"position"];
 69  [self addToArray:items objectDescriptionIfNonNil:[self feedLink] withName:@"feedLink"];
 70  
 71  return items;
 72}
 73#endif
 74
 75+ (NSString *)defaultServiceVersion {
 76  return kGDataFinanceDefaultServiceVersion;
 77}
 78
 79#pragma mark -
 80
 81- (void)setPositionData:(GDataPositionData *)obj {
 82  [self setObject:obj forExtensionClass:[GDataPositionData class]];
 83}
 84
 85- (GDataPositionData *)positionData {
 86  return [self objectForExtensionClass:[GDataPositionData class]]; 
 87}
 88
 89- (void)setFeedLink:(GDataFeedLink *)feedLink {
 90  [self setObject:feedLink forExtensionClass:[GDataFeedLink class]];
 91}
 92
 93- (GDataFeedLink *)feedLink {
 94  return [self objectForExtensionClass:[GDataFeedLink class]]; 
 95}
 96
 97- (void)setSymbol:(GDataFinanceSymbol *)obj {
 98  [self setObject:obj forExtensionClass:[GDataFinanceSymbol class]];
 99}
100
101- (GDataFinanceSymbol *)symbol {
102  return [self objectForExtensionClass:[GDataFinanceSymbol class]]; 
103}
104
105#pragma mark Convenience accessors
106
107- (NSURL *)transactionURL {
108  
109  GDataFeedLink *feedLink = [self feedLink];
110  if (feedLink) {
111    
112    NSString *urlStr = [feedLink href];
113    if ([urlStr length] > 0) {
114      
115      NSURL *url = [NSURL URLWithString:urlStr];
116      return url;
117    }
118  }
119  return nil;
120}
121
122@end
123
124#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE