PageRenderTime 32ms CodeModel.GetById 15ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

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

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