PageRenderTime 42ms CodeModel.GetById 20ms app.highlight 19ms RepoModel.GetById 2ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Docs/GDataEntryDocRevision.m

http://macfuse.googlecode.com/
Objective C | 160 lines | 108 code | 35 blank | 17 comment | 5 complexity | fb4577d56c5625378d5ae22031b94945 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//  GDataEntryDocRevision.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE
 21
 22#import "GDataEntryDocRevision.h"
 23#import "GDataDocConstants.h"
 24
 25@implementation GDataDocPublish
 26+ (NSString *)extensionElementURI       { return kGDataNamespaceDocuments; }
 27+ (NSString *)extensionElementPrefix    { return kGDataNamespaceDocumentsPrefix; }
 28+ (NSString *)extensionElementLocalName { return @"publish"; }
 29@end
 30
 31@implementation GDataDocPublishAuto
 32+ (NSString *)extensionElementURI       { return kGDataNamespaceDocuments; }
 33+ (NSString *)extensionElementPrefix    { return kGDataNamespaceDocumentsPrefix; }
 34+ (NSString *)extensionElementLocalName { return @"publishAuto"; }
 35@end
 36
 37@implementation GDataDocPublishOutsideDomain
 38+ (NSString *)extensionElementURI       { return kGDataNamespaceDocuments; }
 39+ (NSString *)extensionElementPrefix    { return kGDataNamespaceDocumentsPrefix; }
 40+ (NSString *)extensionElementLocalName { return @"publishOutsideDomain"; }
 41@end
 42
 43@implementation GDataEntryDocRevision
 44
 45+ (NSString *)coreProtocolVersionForServiceVersion:(NSString *)serviceVersion {
 46  return [GDataDocConstants coreProtocolVersionForServiceVersion:serviceVersion];
 47}
 48
 49+ (NSString *)standardEntryKind {
 50  return kGDataCategoryDocRevision;
 51}
 52
 53+ (void)load {
 54  [self registerEntryClass];
 55}
 56
 57+ (id)revisionEntry {
 58  GDataEntryDocRevision *obj = [self object];
 59
 60  [obj setNamespaces:[GDataDocConstants baseDocumentNamespaces]];
 61
 62  return obj;
 63}
 64
 65- (void)addExtensionDeclarations {
 66
 67  [super addExtensionDeclarations];
 68
 69  [self addExtensionDeclarationForParentClass:[self class]
 70                                 childClasses:
 71   [GDataDocPublish class],
 72   [GDataDocPublishAuto class],
 73   [GDataDocPublishOutsideDomain class],
 74   nil];
 75}
 76
 77#if !GDATA_SIMPLE_DESCRIPTIONS
 78- (NSMutableArray *)itemsForDescription {
 79
 80  static struct GDataDescriptionRecord descRecs[] = {
 81    { @"publish",              @"publish",              kGDataDescBooleanPresent },
 82    { @"publishAuto",          @"publishAuto",          kGDataDescBooleanPresent },
 83    { @"publishOutsideDomain", @"publishOutsideDomain", kGDataDescBooleanPresent },
 84    { nil, nil, (GDataDescRecTypes)0 }
 85  };
 86
 87  NSMutableArray *items = [super itemsForDescription];
 88  [self addDescriptionRecords:descRecs toItems:items];
 89  return items;
 90}
 91#endif
 92
 93#pragma mark -
 94
 95- (NSNumber *)publish { // BOOL
 96  GDataDocPublish *obj = [self objectForExtensionClass:[GDataDocPublish class]];
 97  return [obj boolNumberValue];
 98}
 99
100- (void)setPublish:(NSNumber *)num {
101  GDataDocPublish *obj = [GDataDocPublish valueWithBool:[num boolValue]];
102  [self setObject:obj forExtensionClass:[GDataDocPublish class]];
103}
104
105- (NSNumber *)publishAuto { // BOOL
106  GDataDocPublishAuto *obj = [self objectForExtensionClass:[GDataDocPublishAuto class]];
107  return [obj boolNumberValue];
108}
109
110- (void)setPublishAuto:(NSNumber *)num {
111  GDataDocPublishAuto *obj = [GDataDocPublishAuto valueWithBool:[num boolValue]];
112  [self setObject:obj forExtensionClass:[GDataDocPublishAuto class]];
113}
114
115- (NSNumber *)publishOutsideDomain { // BOOL
116  GDataDocPublishOutsideDomain *obj;
117
118  obj = [self objectForExtensionClass:[GDataDocPublishOutsideDomain class]];
119  return [obj boolNumberValue];
120}
121
122- (void)setPublishOutsideDomain:(NSNumber *)num {
123  GDataDocPublishOutsideDomain *obj;
124
125  obj = [GDataDocPublishOutsideDomain valueWithBool:[num boolValue]];
126  [self setObject:obj forExtensionClass:[GDataDocPublishOutsideDomain class]];
127}
128
129#pragma mark -
130
131- (GDataPerson *)modifyingUser {
132  NSArray *authors = [self authors];
133  if ([authors count] > 0) {
134    GDataPerson *obj = [authors objectAtIndex:0];
135    return obj;
136  }
137  return nil;
138}
139
140- (void)setModifyingUser:(GDataPerson *)obj {
141  NSArray *authors;
142  if (obj != nil) {
143    authors = [NSArray arrayWithObject:obj];
144  } else {
145    authors = nil;
146  }
147  [self setAuthors:authors];
148}
149
150- (GDataLink *)publishedLink {
151  return [self linkWithRelAttributeValue:kGDataDocsPublishedRel];
152}
153
154+ (NSString *)defaultServiceVersion {
155  return kGDataDocsDefaultServiceVersion;
156}
157
158@end
159
160#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE