PageRenderTime 37ms CodeModel.GetById 1ms app.highlight 33ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/WebmasterTools/GDataEntrySite.m

http://macfuse.googlecode.com/
Objective C | 305 lines | 214 code | 74 blank | 17 comment | 1 complexity | 0323c1871e9a85b6e945da5de9fc68ab 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//  GDataEntrySite.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE
 21
 22#import "GDataEntrySite.h"
 23#import "GDataWebmasterToolsConstants.h"
 24
 25@interface GDataSiteCrawledDate : GDataValueElementConstruct <GDataExtension>
 26@end
 27
 28@implementation GDataSiteCrawledDate
 29+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 30+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 31+ (NSString *)extensionElementLocalName { return @"crawled"; }
 32@end
 33
 34@interface GDataSiteVerified : GDataValueElementConstruct <GDataExtension>
 35@end
 36
 37@implementation GDataSiteVerified
 38+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 39+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 40+ (NSString *)extensionElementLocalName { return @"verified"; }
 41@end
 42
 43@interface GDataSiteIndexed : GDataValueElementConstruct <GDataExtension>
 44@end
 45
 46@implementation GDataSiteIndexed
 47+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 48+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 49+ (NSString *)extensionElementLocalName { return @"indexed"; }
 50@end
 51
 52@interface GDataSiteGeoLocation : GDataValueElementConstruct <GDataExtension>
 53@end
 54
 55@implementation GDataSiteGeoLocation
 56+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 57+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 58+ (NSString *)extensionElementLocalName { return @"geolocation"; }
 59@end
 60
 61@interface GDataSiteCrawlRate : GDataValueElementConstruct <GDataExtension>
 62@end
 63
 64@implementation GDataSiteCrawlRate
 65+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 66+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 67+ (NSString *)extensionElementLocalName { return @"crawl-rate"; }
 68@end
 69
 70@interface GDataSitePreferredDomain : GDataValueElementConstruct <GDataExtension>
 71@end
 72
 73@implementation GDataSitePreferredDomain
 74+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 75+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 76+ (NSString *)extensionElementLocalName { return @"preferred-domain"; }
 77@end
 78
 79@interface GDataSiteEnhancedImageSearch : GDataValueElementConstruct <GDataExtension>
 80@end
 81
 82@implementation GDataSiteEnhancedImageSearch
 83+ (NSString *)extensionElementURI       { return kGDataNamespaceWebmasterTools; }
 84+ (NSString *)extensionElementPrefix    { return kGDataNamespaceWebmasterToolsPrefix; }
 85+ (NSString *)extensionElementLocalName { return @"enhanced-image-search"; }
 86@end
 87
 88
 89@implementation GDataEntrySite
 90
 91+ (NSDictionary *)webmasterToolsNamespaces {
 92
 93  NSMutableDictionary *namespaces;
 94
 95  namespaces = [NSMutableDictionary dictionaryWithObject:kGDataNamespaceWebmasterTools
 96                                                  forKey:kGDataNamespaceWebmasterToolsPrefix];
 97
 98  [namespaces addEntriesFromDictionary:[GDataEntryBase baseGDataNamespaces]];
 99
100  return namespaces;
101}
102
103+ (GDataEntrySite *)siteEntry {
104
105  GDataEntrySite *obj;
106  obj = [self object];
107
108  [obj setNamespaces:[GDataWebmasterToolsConstants webmasterToolsNamespaces]];
109
110  return obj;
111}
112
113#pragma mark -
114
115+ (NSString *)standardEntryKind {
116  return kGDataCategorySiteInfo;
117}
118
119+ (void)load {
120  [self registerEntryClass];
121}
122
123- (void)addExtensionDeclarations {
124
125  [super addExtensionDeclarations];
126
127  Class entryClass = [self class];
128
129  [self addExtensionDeclarationForParentClass:entryClass
130                                 childClasses:
131   [GDataSiteCrawledDate class],
132   [GDataSiteVerified class],
133   [GDataSiteIndexed class],
134   [GDataSiteGeoLocation class],
135   [GDataSiteCrawlRate class],
136   [GDataSitePreferredDomain class],
137   [GDataSiteEnhancedImageSearch class],
138   [GDataEntryLink class],
139   [GDataSiteVerificationMethod class],
140   nil];
141}
142
143#if !GDATA_SIMPLE_DESCRIPTIONS
144- (NSMutableArray *)itemsForDescription {
145
146  static struct GDataDescriptionRecord descRecs[] = {
147    { @"entryLinks",          @"entryLinks",             kGDataDescArrayCount     },
148    { @"indexed",             @"isIndexed",              kGDataDescBooleanLabeled },
149    { @"crawled",             @"crawledDate",            kGDataDescValueLabeled   },
150    { @"geolocation",         @"geoLocation",            kGDataDescValueLabeled   },
151    { @"crawlRate",           @"crawlRate",              kGDataDescValueLabeled   },
152    { @"preferredDomain",     @"preferredDomain",        kGDataDescValueLabeled   },
153    { @"verified",            @"isVerified",             kGDataDescBooleanLabeled },
154    { @"enhancedImageSearch", @"hasEnhancedImageSearch", kGDataDescBooleanLabeled },
155    { @"methods",             @"verificationMethods",    kGDataDescArrayDescs     },
156    { nil, nil, (GDataDescRecTypes)0 }
157  };
158
159  NSMutableArray *items = [super itemsForDescription];
160  [self addDescriptionRecords:descRecs toItems:items];
161  return items;
162}
163#endif
164
165+ (NSString *)defaultServiceVersion {
166  return kGDataWebmasterToolsDefaultServiceVersion;
167}
168
169#pragma mark -
170
171- (BOOL)isIndexed {
172  id obj = [self objectForExtensionClass:[GDataSiteIndexed class]];
173  return [obj boolValue];
174}
175
176- (void)setIsIndexed:(BOOL)flag {
177  GDataSiteIndexed *obj = [GDataSiteIndexed valueWithBool:flag];
178  [self setObject:obj forExtensionClass:[GDataSiteIndexed class]];
179}
180
181- (GDataDateTime *)crawledDate {
182  id obj = [self objectForExtensionClass:[GDataSiteCrawledDate class]];
183  return [obj dateTimeValue];
184}
185
186- (void)setCrawledDate:(GDataDateTime *)dateTime {
187  GDataSiteCrawledDate *obj = [GDataSiteCrawledDate valueWithDateTime:dateTime];
188  [self setObject:obj forExtensionClass:[GDataSiteCrawledDate class]];
189}
190
191- (BOOL)isVerified {
192  id obj = [self objectForExtensionClass:[GDataSiteVerified class]];
193  return [obj boolValue];
194}
195
196- (void)setIsVerified:(BOOL)flag {
197  GDataSiteVerified *obj = [GDataSiteVerified valueWithBool:flag];
198  [self setObject:obj forExtensionClass:[GDataSiteVerified class]];
199}
200
201- (NSString *)geoLocation {
202  GDataSiteGeoLocation *obj;
203
204  obj = [self objectForExtensionClass:[GDataSiteGeoLocation class]];
205  return [obj stringValue];
206}
207
208- (void)setGeoLocation:(NSString *)str {
209  GDataSiteGeoLocation *obj;
210
211  obj = [GDataSiteGeoLocation valueWithString:str];
212  [self setObject:obj forExtensionClass:[GDataSiteGeoLocation class]];
213}
214
215- (NSString *)crawlRate {
216  GDataSiteCrawlRate *obj;
217
218  obj = [self objectForExtensionClass:[GDataSiteCrawlRate class]];
219  return [obj stringValue];
220}
221
222- (void)setCrawlRate:(NSString *)str {
223  GDataSiteCrawlRate *obj = [GDataSiteCrawlRate valueWithString:str];
224  [self setObject:obj forExtensionClass:[GDataSiteCrawlRate class]];
225}
226
227- (NSString *)preferredDomain {
228  GDataSitePreferredDomain *obj;
229
230  obj = [self objectForExtensionClass:[GDataSitePreferredDomain class]];
231  return [obj stringValue];
232}
233
234- (void)setPreferredDomain:(NSString *)str {
235  GDataSitePreferredDomain *obj;
236
237  obj = [GDataSitePreferredDomain valueWithString:str];
238  [self setObject:obj forExtensionClass:[GDataSitePreferredDomain class]];
239}
240
241- (BOOL)hasEnhancedImageSearch {
242  id obj = [self objectForExtensionClass:[GDataSiteEnhancedImageSearch class]];
243  return [obj boolValue];
244}
245
246- (void)setHasEnhancedImageSearch:(BOOL)flag {
247  GDataSiteEnhancedImageSearch *obj;
248
249  obj = [GDataSiteEnhancedImageSearch valueWithBool:flag];
250  [self setObject:obj forExtensionClass:[GDataSiteEnhancedImageSearch class]];
251}
252
253- (NSArray *)verificationMethods {
254  return [self objectsForExtensionClass:[GDataSiteVerificationMethod class]];
255}
256
257- (void)setVerificationMethods:(NSArray *)array {
258  [self setObjects:array forExtensionClass:[GDataSiteVerificationMethod class]];
259}
260
261- (void)addVerificationMethod:(GDataSiteVerificationMethod *)obj {
262  [self addObject:obj forExtensionClass:[GDataSiteVerificationMethod class]];
263}
264
265- (NSArray *)entryLinks {
266  return [self objectsForExtensionClass:[GDataEntryLink class]];
267}
268
269- (void)setEntryLinks:(NSArray *)arr {
270  [self setObjects:arr forExtensionClass:[GDataEntryLink class]];
271}
272
273- (void)addEntryLink:(GDataEntryLink *)obj {
274  [self addObject:obj forExtensionClass:[GDataEntryLink class]];
275}
276
277#pragma mark Convenience accessors
278
279- (GDataEntryLink *)verificationEntryLink {
280
281  GDataEntryLink *obj = [GDataUtilities firstObjectFromArray:[self entryLinks]
282                                                   withValue:kGDataSiteVerificationRel
283                                                  forKeyPath:@"rel"];
284  return obj;
285}
286
287- (GDataEntryLink *)sitemapsEntryLink {
288  GDataEntryLink *obj = [GDataUtilities firstObjectFromArray:[self entryLinks]
289                                                   withValue:kGDataSiteSitemapsRel
290                                                  forKeyPath:@"rel"];
291  return obj;
292}
293
294- (GDataSiteVerificationMethod *)verificationMethodInUse {
295
296  GDataSiteVerificationMethod *method;
297  method = [GDataUtilities firstObjectFromArray:[self verificationMethods]
298                                      withValue:[NSNumber numberWithBool:YES]
299                                     forKeyPath:@"isInUse"];
300  return method;
301}
302
303@end
304
305#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE