PageRenderTime 109ms CodeModel.GetById 8ms app.highlight 95ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Contacts/GDataEntryContactBase.m

http://macfuse.googlecode.com/
Objective C | 957 lines | 638 code | 279 blank | 40 comment | 46 complexity | 004a58af84c61a68486bea7043ec0fdb 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//  GDataEntryContact.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE
 21
 22#import "GDataEntryContactBase.h"
 23#import "GDataContactConstants.h"
 24
 25@implementation GDataEntryContactBase
 26
 27+ (NSString *)coreProtocolVersionForServiceVersion:(NSString *)serviceVersion {
 28  return [GDataContactConstants coreProtocolVersionForServiceVersion:serviceVersion];
 29}
 30
 31- (void)addExtensionDeclarations {
 32
 33  [super addExtensionDeclarations];
 34
 35  Class entryClass = [self class];
 36
 37  // ContactEntry extensions
 38
 39  [self addExtensionDeclarationForParentClass:entryClass
 40                                 childClasses:
 41   [GDataOrganization class],
 42   [GDataEmail class],
 43   [GDataIM class],
 44   [GDataPhoneNumber class],
 45   [GDataPostalAddress class],
 46   [GDataExtendedProperty class],
 47
 48   // version 3 extensions
 49   [GDataContactBillingInformation class],
 50   [GDataContactBirthday class],
 51   [GDataContactCalendarLink class],
 52   [GDataContactDirectoryServer class],
 53   [GDataContactEvent class],
 54   [GDataContactExternalID class],
 55   [GDataContactGender class],
 56   [GDataContactHobby class],
 57   [GDataContactInitials class],
 58   [GDataContactJot class],
 59   [GDataContactLanguage class],
 60   [GDataWhere class],
 61   [GDataContactMaidenName class],
 62   [GDataContactMileage class],
 63   [GDataName class],
 64   [GDataContactNickname class],
 65   [GDataContactOccupation class],
 66   [GDataContactPriority class],
 67   [GDataContactRelation class],
 68   [GDataContactSensitivity class],
 69   [GDataContactShortName class],
 70   [GDataStructuredPostalAddress class],
 71   [GDataContactSubject class],
 72   [GDataContactUserDefinedField class],
 73   [GDataContactWebsiteLink class],
 74   nil];
 75}
 76
 77#if !GDATA_SIMPLE_DESCRIPTIONS
 78- (NSMutableArray *)itemsForDescription {
 79  static struct GDataDescriptionRecord descRecs[] = {
 80    { @"org",               @"organizations",      kGDataDescArrayDescs },
 81    { @"email",             @"emailAddresses",     kGDataDescArrayDescs },
 82    { @"phone",             @"phoneNumbers",       kGDataDescArrayDescs },
 83    { @"IM",                @"IMAddresses",        kGDataDescArrayDescs },
 84    { @"extProps",          @"extendedProperties", kGDataDescArrayDescs },
 85    { @"version<=2:postal", @"postalAddresses",    kGDataDescArrayDescs },
 86    { nil, nil, (GDataDescRecTypes)0 }
 87  };
 88
 89  NSMutableArray *items = [super itemsForDescription];
 90  [self addDescriptionRecords:descRecs toItems:items];
 91
 92  // description info for methods that assert prior to V3
 93  if ([self isServiceVersionAtLeast:kGDataContactServiceV3]) {
 94    static struct GDataDescriptionRecord descRecsV3[] = {
 95      // v3 extensions
 96      { @"name",         @"name",                      kGDataDescValueLabeled },
 97      { @"structPostal", @"structuredPostalAddresses", kGDataDescArrayDescs   },
 98      { @"billing",      @"billingInformation",        kGDataDescValueLabeled },
 99      { @"birthday",     @"birthday",                  kGDataDescValueLabeled },
100      { @"calendar",     @"calendarLinks",             kGDataDescArrayDescs   },
101      { @"dirServer",    @"directoryServer",           kGDataDescValueLabeled },
102      { @"event",        @"events",                    kGDataDescArrayDescs   },
103      { @"extID",        @"externalIDs",               kGDataDescArrayDescs   },
104      { @"gender",       @"gender",                    kGDataDescValueLabeled },
105      { @"hobby",        @"hobbies",                   kGDataDescArrayDescs   },
106      { @"initials",     @"initials",                  kGDataDescValueLabeled },
107      { @"jot",          @"jots",                      kGDataDescArrayDescs   },
108      { @"lang",         @"languages",                 kGDataDescArrayDescs   },
109      { @"where",        @"where",                     kGDataDescValueLabeled },
110      { @"maidenName",   @"maidenName",                kGDataDescValueLabeled },
111      { @"mileage",      @"mileage",                   kGDataDescValueLabeled },
112      { @"nickname",     @"nickname",                  kGDataDescValueLabeled },
113      { @"occupation",   @"occupation",                kGDataDescValueLabeled },
114      { @"priority",     @"priority",                  kGDataDescValueLabeled },
115      { @"relation",     @"relations",                 kGDataDescArrayDescs   },
116      { @"sensitivity",  @"sensitivity",               kGDataDescValueLabeled },
117      { @"shortName",    @"shortName",                 kGDataDescValueLabeled },
118      { @"subject",      @"subject",                   kGDataDescValueLabeled },
119      { @"userDefd",     @"userDefinedFields",         kGDataDescArrayDescs   },
120      { @"website",      @"websiteLinks",              kGDataDescArrayDescs   },
121
122      { nil, nil, (GDataDescRecTypes)0 }
123    };
124
125    [self addDescriptionRecords:descRecsV3 toItems:items];
126  }
127  return items;
128}
129#endif
130
131#pragma mark -
132
133// The Focus UI does not happily handle empty strings, so we'll force those
134// to be nil
135- (void)setTitle:(GDataTextConstruct *)theTitle {
136  // title is read-only beginning in service version 3
137  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
138
139  if ([[theTitle stringValue] length] == 0) {
140    theTitle = nil;
141  }
142  [super setTitle:theTitle];
143}
144
145- (void)setTitleWithString:(NSString *)str {
146  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
147
148  if ([str length] == 0) {
149    [self setTitle:nil];
150  } else {
151    [super setTitleWithString:str];
152  }
153}
154
155#pragma mark -
156
157// routines to do the work for finding or setting the primary elements
158// of the different extension classes
159
160- (GDataObject *)primaryObjectForExtensionClass:(Class)theClass {
161
162  NSArray *extns = [self objectsForExtensionClass:theClass];
163
164  for (GDataObject *obj in extns) {
165    if ([(id)obj isPrimary]) return obj;
166  }
167  return nil;
168}
169
170- (void)setPrimaryObject:(GDataObject *)newPrimaryObj
171       forExtensionClass:(Class)theClass {
172  NSArray *extns =  [self objectsForExtensionClass:theClass];
173
174  BOOL foundIt = NO;
175  for (GDataObject *obj in extns) {
176    BOOL isPrimary = [newPrimaryObj isEqual:obj];
177    [(id)obj setIsPrimary:isPrimary];
178
179    if (isPrimary) foundIt = YES;
180  }
181
182  // if the object isn't already in the list, add it
183  if (!foundIt && newPrimaryObj != nil) {
184    [(id)newPrimaryObj setIsPrimary:YES];
185    [self addObject:newPrimaryObj forExtensionClass:theClass];
186  }
187}
188
189#pragma mark -
190
191- (NSArray *)organizations {
192  return [self objectsForExtensionClass:[GDataOrganization class]];
193}
194
195- (void)setOrganizations:(NSArray *)array {
196  [self setObjects:array forExtensionClass:[GDataOrganization class]];
197}
198
199- (void)addOrganization:(GDataOrganization *)obj {
200  [self addObject:obj forExtensionClass:[GDataOrganization class]];
201}
202
203- (void)removeOrganization:(GDataOrganization *)obj {
204  [self removeObject:obj forExtensionClass:[GDataOrganization class]];
205}
206
207- (GDataOrganization *)primaryOrganization {
208  id obj = [self primaryObjectForExtensionClass:[GDataOrganization class]];
209  return obj;
210}
211
212- (void)setPrimaryOrganization:(GDataOrganization *)obj {
213  [self setPrimaryObject:obj forExtensionClass:[GDataOrganization class]];
214}
215
216
217- (NSArray *)emailAddresses {
218  return [self objectsForExtensionClass:[GDataEmail class]];
219}
220
221- (void)setEmailAddresses:(NSArray *)array {
222  [self setObjects:array forExtensionClass:[GDataEmail class]];
223}
224
225- (void)addEmailAddress:(GDataEmail *)obj {
226  [self addObject:obj forExtensionClass:[GDataEmail class]];
227}
228
229- (void)removeEmailAddress:(GDataEmail *)obj {
230  [self removeObject:obj forExtensionClass:[GDataEmail class]];
231}
232
233- (GDataEmail *)primaryEmailAddress {
234  id obj = [self primaryObjectForExtensionClass:[GDataEmail class]];
235  return obj;
236}
237
238- (void)setPrimaryEmailAddress:(GDataEmail *)obj {
239  [self setPrimaryObject:obj forExtensionClass:[GDataEmail class]];
240}
241
242
243- (NSArray *)IMAddresses {
244  return [self objectsForExtensionClass:[GDataIM class]];
245}
246
247- (void)setIMAddresses:(NSArray *)array {
248  [self setObjects:array forExtensionClass:[GDataIM class]];
249}
250
251- (GDataIM *)primaryIMAddress {
252  id obj = [self primaryObjectForExtensionClass:[GDataIM class]];
253  return obj;
254}
255
256- (void)setPrimaryIMAddress:(GDataIM *)obj {
257  [self setPrimaryObject:obj forExtensionClass:[GDataIM class]];
258}
259
260- (void)addIMAddress:(GDataIM *)obj {
261  [self addObject:obj forExtensionClass:[GDataIM class]];
262}
263
264- (void)removeIMAddress:(GDataIM *)obj {
265  [self removeObject:obj forExtensionClass:[GDataIM class]];
266}
267
268
269- (NSArray *)phoneNumbers {
270  return [self objectsForExtensionClass:[GDataPhoneNumber class]];
271}
272
273- (void)setPhoneNumbers:(NSArray *)array {
274  [self setObjects:array forExtensionClass:[GDataPhoneNumber class]];
275}
276
277- (void)addPhoneNumber:(GDataPhoneNumber *)obj {
278  [self addObject:obj forExtensionClass:[GDataPhoneNumber class]];
279}
280
281- (void)removePhoneNumber:(GDataPhoneNumber *)obj {
282  [self removeObject:obj forExtensionClass:[GDataPhoneNumber class]];
283}
284
285- (GDataPhoneNumber *)primaryPhoneNumber {
286  id obj = [self primaryObjectForExtensionClass:[GDataPhoneNumber class]];
287  return obj;
288}
289
290- (void)setPrimaryPhoneNumber:(GDataPhoneNumber *)obj {
291  [self setPrimaryObject:obj forExtensionClass:[GDataPhoneNumber class]];
292}
293
294
295- (NSArray *)postalAddresses {
296  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
297
298  return [self objectsForExtensionClass:[GDataPostalAddress class]];
299}
300
301- (void)setPostalAddresses:(NSArray *)array {
302  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
303
304  [self setObjects:array forExtensionClass:[GDataPostalAddress class]];
305}
306
307- (void)addPostalAddress:(GDataPostalAddress *)obj {
308  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
309
310  [self addObject:obj forExtensionClass:[GDataPostalAddress class]];
311}
312
313- (void)removePostalAddress:(GDataPostalAddress *)obj {
314  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
315
316  [self removeObject:obj forExtensionClass:[GDataPostalAddress class]];
317}
318
319- (GDataPostalAddress *)primaryPostalAddress {
320  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
321
322  id obj = [self primaryObjectForExtensionClass:[GDataPostalAddress class]];
323  return obj;
324}
325
326- (void)setPrimaryPostalAddress:(GDataPostalAddress *)obj {
327  GDATA_DEBUG_ASSERT_MAX_SERVICE_VERSION(kGDataContactServiceV2);
328
329  [self setPrimaryObject:obj forExtensionClass:[GDataPostalAddress class]];
330}
331
332
333- (NSArray *)extendedProperties {
334  return [self objectsForExtensionClass:[GDataExtendedProperty class]];
335}
336
337- (void)setExtendedProperties:(NSArray *)arr {
338  [self setObjects:arr forExtensionClass:[GDataExtendedProperty class]];
339}
340
341- (void)addExtendedProperty:(GDataExtendedProperty *)obj {
342  [self addObject:obj forExtensionClass:[GDataExtendedProperty class]];
343}
344
345- (void)removeExtendedProperty:(GDataExtendedProperty *)obj {
346  [self removeObject:obj forExtensionClass:[GDataExtendedProperty class]];
347}
348
349- (GDataExtendedProperty *)extendedPropertyForName:(NSString *)str {
350
351  GDataExtendedProperty *extProp = nil;
352
353  NSArray *array = [self extendedProperties];
354  if (array != nil) {
355    extProp = [GDataUtilities firstObjectFromArray:array
356                                         withValue:str
357                                        forKeyPath:@"name"];
358  }
359  return extProp;
360}
361
362// version 3 elements
363
364- (NSString *)billingInformation {
365  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
366
367  GDataContactBillingInformation *obj;
368  obj = [self objectForExtensionClass:[GDataContactBillingInformation class]];
369  return [obj stringValue];
370}
371
372- (void)setBillingInformation:(NSString *)str {
373  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
374
375  if ([str length] == 0) str = nil;
376
377  GDataContactBillingInformation *obj;
378  obj = [GDataContactBillingInformation valueWithString:str];
379
380  [self setObject:obj forExtensionClass:[GDataContactBillingInformation class]];
381}
382
383
384- (NSString *)birthday {
385  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
386
387  GDataContactBirthday *obj;
388  obj = [self objectForExtensionClass:[GDataContactBirthday class]];
389  return [obj stringValue];
390}
391
392- (void)setBirthday:(NSString *)str {
393  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
394
395  if ([str length] == 0) str = nil;
396
397  GDataContactBirthday *obj;
398  obj = [GDataContactBirthday valueWithString:str];
399
400  [self setObject:obj forExtensionClass:[GDataContactBirthday class]];
401}
402
403// Google Contacts allows birthdates with undefined years, like "--12-25"
404//
405// http://code.google.com/apis/contacts/docs/3.0/reference.html#gcBirthday
406//
407// We'll use 1804 for the year, making an obvious "unset" value to display
408// in Apple's UI
409
410- (NSDate *)birthdayDate {
411  // get the birthday string, like 1970-12-25 or --12-25
412  NSString *str = [self birthday];
413
414  // convert a leading "-" year to 1804, since that's a clearly invalid
415  // year that allows February 29
416  if ([str hasPrefix:@"--"] && [str length] > 2) {
417    NSString *monthDayString = [str substringFromIndex:2];
418    str = [NSString stringWithFormat:@"1804-%@", monthDayString];
419  }
420
421  // add a time string to make it noon UTC, avoiding the chance that
422  // a different time zone rendering would change the date
423  str = [str stringByAppendingString:@" 12:00:00 -0000"];
424
425  static NSDateFormatter *formatter = nil;
426  if (formatter == nil) {
427    formatter = [[NSDateFormatter alloc] init];
428    [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
429    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZ"];
430  }
431
432  NSDate *date = [formatter dateFromString:str];
433  return date;
434}
435
436- (void)setBirthdayWithDate:(NSDate *)date {
437  static NSDateFormatter *formatter = nil;
438  if (formatter == nil) {
439    formatter = [[NSDateFormatter alloc] init];
440    [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
441    [formatter setDateFormat:@"yyyy-MM-dd"];
442    [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"Universal"]];
443  }
444
445  NSString *str = [formatter stringFromDate:date];
446
447  // convert a "1804" year to "-"
448  if ([str hasPrefix:@"1804-"] && [str length] > 5) {
449    NSString *monthDayString = [str substringFromIndex:5];
450    str = [NSString stringWithFormat:@"--%@", monthDayString];
451  }
452  [self setBirthday:str];
453}
454
455- (NSArray *)calendarLinks {
456  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
457
458  return [self objectsForExtensionClass:[GDataContactCalendarLink class]];
459}
460
461- (void)setCalendarLinks:(NSArray *)array {
462  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
463
464  [self setObjects:array forExtensionClass:[GDataContactCalendarLink class]];
465}
466
467- (void)addCalendarLink:(GDataContactCalendarLink *)obj {
468  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
469
470  [self addObject:obj forExtensionClass:[GDataContactCalendarLink class]];
471}
472
473- (void)removeCalendarLink:(GDataContactCalendarLink *)obj {
474  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
475
476  [self removeObject:obj forExtensionClass:[GDataContactCalendarLink class]];
477}
478
479- (GDataContactCalendarLink *)primaryCalendarLink {
480  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
481
482  id obj = [self primaryObjectForExtensionClass:[GDataContactCalendarLink class]];
483  return obj;
484}
485
486- (void)setPrimaryCalendarLink:(GDataContactCalendarLink *)obj {
487  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
488
489  [self setPrimaryObject:obj forExtensionClass:[GDataContactCalendarLink class]];
490}
491
492
493- (NSString *)directoryServer {
494  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
495
496  GDataContactDirectoryServer *obj;
497  obj = [self objectForExtensionClass:[GDataContactDirectoryServer class]];
498  return [obj stringValue];
499}
500
501- (void)setDirectoryServer:(NSString *)str {
502  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
503
504  if ([str length] == 0) str = nil;
505
506  GDataContactDirectoryServer *obj;
507  obj = [GDataContactDirectoryServer valueWithString:str];
508
509  [self setObject:obj forExtensionClass:[GDataContactDirectoryServer class]];
510}
511
512
513- (NSArray *)events {
514  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
515
516  return [self objectsForExtensionClass:[GDataContactEvent class]];
517}
518
519- (void)setEvents:(NSArray *)array {
520  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
521
522  [self setObjects:array forExtensionClass:[GDataContactEvent class]];
523}
524
525- (void)addEvent:(GDataContactEvent *)obj {
526  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
527
528  [self addObject:obj forExtensionClass:[GDataContactEvent class]];
529}
530
531- (NSArray *)externalIDs {
532  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
533
534  return [self objectsForExtensionClass:[GDataContactExternalID class]];
535}
536
537- (void)setExternalIDs:(NSArray *)array {
538  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
539
540  [self setObjects:array forExtensionClass:[GDataContactExternalID class]];
541}
542
543- (void)addExternalID:(GDataContactExternalID *)obj {
544  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
545
546  [self addObject:obj forExtensionClass:[GDataContactExternalID class]];
547}
548
549
550- (NSString *)gender {
551  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
552
553  GDataContactGender *obj;
554  obj = [self objectForExtensionClass:[GDataContactGender class]];
555  return [obj stringValue];
556}
557
558- (void)setGender:(NSString *)str {
559  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
560
561  if ([str length] == 0) str = nil;
562
563  GDataContactGender *obj;
564  obj = [GDataContactGender valueWithString:str];
565
566  [self setObject:obj forExtensionClass:[GDataContactGender class]];
567}
568
569
570- (NSArray *)hobbies {
571  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
572
573  return [self objectsForExtensionClass:[GDataContactHobby class]];
574}
575
576- (void)setHobbies:(NSArray *)array {
577  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
578
579  [self setObjects:array forExtensionClass:[GDataContactHobby class]];
580}
581
582- (void)addHobby:(GDataContactHobby *)obj {
583  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
584
585  [self addObject:obj forExtensionClass:[GDataContactHobby class]];
586}
587
588
589- (NSString *)initials {
590  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
591
592  GDataContactInitials *obj;
593  obj = [self objectForExtensionClass:[GDataContactInitials class]];
594  return [obj stringValue];
595}
596
597- (void)setInitials:(NSString *)str {
598  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
599
600  if ([str length] == 0) str = nil;
601
602  GDataContactInitials *obj;
603  obj = [GDataContactInitials valueWithString:str];
604
605  [self setObject:obj forExtensionClass:[GDataContactInitials class]];
606}
607
608
609- (NSArray *)jots {
610  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
611
612  return [self objectsForExtensionClass:[GDataContactJot class]];
613}
614
615- (void)setJots:(NSArray *)array {
616  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
617
618  [self setObjects:array forExtensionClass:[GDataContactJot class]];
619}
620
621- (void)addJot:(GDataContactJot *)obj {
622  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
623
624  [self addObject:obj forExtensionClass:[GDataContactJot class]];
625}
626
627
628- (NSArray *)languages {
629  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
630
631  return [self objectsForExtensionClass:[GDataContactLanguage class]];
632}
633
634- (void)setLanguages:(NSArray *)array {
635  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
636
637  [self setObjects:array forExtensionClass:[GDataContactLanguage class]];
638}
639
640- (void)addLanguage:(GDataContactLanguage *)obj {
641  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
642
643  [self addObject:obj forExtensionClass:[GDataContactLanguage class]];
644}
645
646
647- (GDataWhere *)where {
648  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
649
650  return [self objectForExtensionClass:[GDataWhere class]];
651}
652
653- (void)setWhere:(GDataWhere *)obj {
654  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
655
656  [self setObject:obj forExtensionClass:[GDataWhere class]];
657}
658
659
660- (NSString *)maidenName {
661  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
662
663  GDataContactMaidenName *obj;
664  obj = [self objectForExtensionClass:[GDataContactMaidenName class]];
665  return [obj stringValue];
666}
667
668- (void)setMaidenName:(NSString *)str {
669  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
670
671  if ([str length] == 0) str = nil;
672
673  GDataContactMaidenName *obj;
674  obj = [GDataContactMaidenName valueWithString:str];
675
676  [self setObject:obj forExtensionClass:[GDataContactMaidenName class]];
677}
678
679
680- (NSString *)mileage {
681  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
682
683  GDataContactMileage *obj;
684  obj = [self objectForExtensionClass:[GDataContactMileage class]];
685  return [obj stringValue];
686}
687
688- (void)setMileage:(NSString *)str {
689  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
690
691  if ([str length] == 0) str = nil;
692
693  GDataContactMileage *obj;
694  obj = [GDataContactMileage valueWithString:str];
695
696  [self setObject:obj forExtensionClass:[GDataContactMileage class]];
697}
698
699
700- (GDataName *)name {
701  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
702
703  GDataName *obj = [self objectForExtensionClass:[GDataName class]];
704  return obj;
705}
706
707- (void)setName:(GDataName *)obj {
708  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
709
710  [self setObject:obj forExtensionClass:[GDataName class]];
711}
712
713- (NSString *)nickname {
714  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
715
716  GDataContactNickname *obj;
717  obj = [self objectForExtensionClass:[GDataContactNickname class]];
718  return [obj stringValue];
719}
720
721- (void)setNickname:(NSString *)str {
722  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
723
724  if ([str length] == 0) str = nil;
725
726  GDataContactNickname *obj;
727  obj = [GDataContactNickname valueWithString:str];
728
729  [self setObject:obj forExtensionClass:[GDataContactNickname class]];
730}
731
732
733- (NSString *)occupation {
734  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
735
736  GDataContactOccupation *obj;
737  obj = [self objectForExtensionClass:[GDataContactOccupation class]];
738  return [obj stringValue];
739}
740
741- (void)setOccupation:(NSString *)str {
742  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
743
744  if ([str length] == 0) str = nil;
745
746  GDataContactOccupation *obj;
747  obj = [GDataContactOccupation valueWithString:str];
748
749  [self setObject:obj forExtensionClass:[GDataContactOccupation class]];
750}
751
752
753- (NSString *)priority {
754  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
755
756  GDataContactPriority *obj;
757  obj = [self objectForExtensionClass:[GDataContactPriority class]];
758  return [obj rel];
759}
760
761- (void)setPriority:(NSString *)str {
762
763  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
764
765  GDataContactPriority *obj;
766  obj = [GDataContactPriority priorityWithRel:str];
767
768  [self setObject:obj forExtensionClass:[GDataContactPriority class]];
769}
770
771
772- (NSArray *)relations {
773  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
774
775  return [self objectsForExtensionClass:[GDataContactRelation class]];
776}
777
778- (void)setRelations:(NSArray *)array {
779  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
780
781  [self setObjects:array forExtensionClass:[GDataContactRelation class]];
782}
783
784- (void)addRelation:(GDataContactRelation *)obj {
785  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
786
787  [self addObject:obj forExtensionClass:[GDataContactRelation class]];
788}
789
790
791- (NSString *)sensitivity {
792  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
793
794  GDataContactSensitivity *obj;
795  obj = [self objectForExtensionClass:[GDataContactSensitivity class]];
796  return [obj rel];
797}
798
799- (void)setSensitivity:(NSString *)str {
800  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
801
802  GDataContactOccupation *obj;
803  obj = [GDataContactSensitivity sensitivityWithRel:str];
804
805  [self setObject:obj forExtensionClass:[GDataContactSensitivity class]];
806}
807
808
809- (NSString *)shortName {
810  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
811
812  GDataContactShortName *obj;
813  obj = [self objectForExtensionClass:[GDataContactShortName class]];
814  return [obj stringValue];
815}
816
817- (void)setShortName:(NSString *)str {
818  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
819
820  if ([str length] == 0) str = nil;
821
822  GDataContactShortName *obj;
823  obj = [GDataContactShortName valueWithString:str];
824
825  [self setObject:obj forExtensionClass:[GDataContactShortName class]];
826}
827
828
829- (NSArray *)structuredPostalAddresses {
830  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
831
832  return [self objectsForExtensionClass:[GDataStructuredPostalAddress class]];
833}
834
835- (void)setStructuredPostalAddresses:(NSArray *)arr {
836  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
837
838  [self setObjects:arr forExtensionClass:[GDataStructuredPostalAddress class]];
839}
840
841- (void)addStructuredPostalAddress:(GDataStructuredPostalAddress *)obj {
842  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
843
844  [self addObject:obj forExtensionClass:[GDataStructuredPostalAddress class]];
845}
846
847- (void)removeStructuredPostalAddress:(GDataStructuredPostalAddress *)obj {
848  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
849
850  [self removeObject:obj forExtensionClass:[GDataStructuredPostalAddress class]];
851}
852
853- (GDataStructuredPostalAddress *)primaryStructuredPostalAddress {
854  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
855
856  id obj = [self primaryObjectForExtensionClass:[GDataStructuredPostalAddress class]];
857  return obj;
858}
859
860- (void)setPrimaryStructuredPostalAddress:(GDataStructuredPostalAddress *)obj {
861  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
862
863  [self setPrimaryObject:obj forExtensionClass:[GDataStructuredPostalAddress class]];
864}
865
866
867- (NSString *)subject {
868  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
869
870  GDataContactSubject *obj;
871  obj = [self objectForExtensionClass:[GDataContactSubject class]];
872  return [obj stringValue];
873}
874
875- (void)setSubject:(NSString *)str {
876  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
877
878  if ([str length] == 0) str = nil;
879
880  GDataContactSubject *obj;
881  obj = [GDataContactSubject valueWithString:str];
882
883  [self setObject:obj forExtensionClass:[GDataContactSubject class]];
884}
885
886
887- (NSArray *)userDefinedFields {
888  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
889
890  return [self objectsForExtensionClass:[GDataContactUserDefinedField class]];
891}
892
893- (void)setUserDefinedFields:(NSArray *)arr {
894  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
895
896  [self setObjects:arr forExtensionClass:[GDataContactUserDefinedField class]];
897}
898
899- (void)addUserDefinedField:(GDataContactUserDefinedField *)obj {
900  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
901
902  [self addObject:obj forExtensionClass:[GDataContactUserDefinedField class]];
903}
904
905- (void)removeUserDefinedField:(GDataContactUserDefinedField *)obj {
906  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
907
908  [self removeObject:obj forExtensionClass:[GDataContactUserDefinedField class]];
909}
910
911
912- (NSArray *)websiteLinks {
913  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
914
915  return [self objectsForExtensionClass:[GDataContactWebsiteLink class]];
916}
917
918- (void)setWebsiteLinks:(NSArray *)array {
919  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
920
921  [self setObjects:array forExtensionClass:[GDataContactWebsiteLink class]];
922}
923
924- (void)addWebsiteLink:(GDataContactWebsiteLink *)obj {
925  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
926
927  [self addObject:obj forExtensionClass:[GDataContactWebsiteLink class]];
928}
929
930- (void)removeWebsiteLink:(GDataContactWebsiteLink *)obj {
931  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
932
933  [self removeObject:obj forExtensionClass:[GDataContactWebsiteLink class]];
934}
935
936- (GDataContactWebsiteLink *)primaryWebsiteLink {
937  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
938
939  id obj = [self primaryObjectForExtensionClass:[GDataContactWebsiteLink class]];
940  return obj;
941}
942
943- (void)setPrimaryWebsiteLink:(GDataContactWebsiteLink *)obj {
944  GDATA_DEBUG_ASSERT_MIN_SERVICE_VERSION(kGDataContactServiceV3);
945
946  [self setPrimaryObject:obj forExtensionClass:[GDataContactWebsiteLink class]];
947}
948
949#pragma mark -
950
951- (GDataLink *)photoLink {
952  return [self linkWithRelAttributeValue:kGDataContactPhotoRel];
953}
954
955@end
956
957#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE