/Source/externals/GData/Source/Clients/WebmasterTools/GDataEntrySitemap.m

http://google-email-uploader-mac.googlecode.com/ · Objective C · 300 lines · 196 code · 87 blank · 17 comment · 9 complexity · 63b72505e229187963278005e8e06433 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. // GDataEntrySitemap.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE
  19. #import "GDataEntrySitemap.h"
  20. #import "GDataWebmasterToolsConstants.h"
  21. @implementation GDataSitemapStatus
  22. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  23. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  24. + (NSString *)extensionElementLocalName { return @"sitemap-status"; }
  25. @end
  26. @implementation GDataSitemapLastDownloaded
  27. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  28. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  29. + (NSString *)extensionElementLocalName { return @"sitemap-last-downloaded"; }
  30. @end
  31. @implementation GDataSitemapURLCount
  32. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  33. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  34. + (NSString *)extensionElementLocalName { return @"sitemap-url-count"; }
  35. @end
  36. @implementation GDataSitemapType
  37. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  38. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  39. + (NSString *)extensionElementLocalName { return @"sitemap-type"; }
  40. @end
  41. @implementation GDataSitemapMobileMarkupLanguage
  42. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  43. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  44. + (NSString *)extensionElementLocalName { return @"sitemap-mobile-markup-language"; }
  45. @end
  46. @implementation GDataSitemapNewsPublicationLabel
  47. + (NSString *)extensionElementPrefix { return kGDataNamespaceWebmasterToolsPrefix; }
  48. + (NSString *)extensionElementURI { return kGDataNamespaceWebmasterTools; }
  49. + (NSString *)extensionElementLocalName { return @"sitemap-news-publication-label"; }
  50. @end
  51. @implementation GDataEntrySitemapBase
  52. + (id)sitemapEntry {
  53. GDataEntrySitemapBase *obj;
  54. obj = [self object];
  55. [obj setNamespaces:[GDataWebmasterToolsConstants webmasterToolsNamespaces]];
  56. return obj;
  57. }
  58. #pragma mark -
  59. - (void)addExtensionDeclarations {
  60. [super addExtensionDeclarations];
  61. Class entryClass = [self class];
  62. [self addExtensionDeclarationForParentClass:entryClass
  63. childClass:[GDataSitemapStatus class]];
  64. [self addExtensionDeclarationForParentClass:entryClass
  65. childClass:[GDataSitemapLastDownloaded class]];
  66. [self addExtensionDeclarationForParentClass:entryClass
  67. childClass:[GDataSitemapURLCount class]];
  68. }
  69. #if !GDATA_SIMPLE_DESCRIPTIONS
  70. - (NSMutableArray *)itemsForDescription {
  71. NSMutableArray *items = [super itemsForDescription];
  72. [self addToArray:items objectDescriptionIfNonNil:[self sitemapStatus] withName:@"status"];
  73. [self addToArray:items objectDescriptionIfNonNil:[self lastDownloadDate] withName:@"lastDownload"];
  74. [self addToArray:items objectDescriptionIfNonNil:[self sitemapURLCount] withName:@"URLCount"];
  75. return items;
  76. }
  77. #endif
  78. + (NSString *)defaultServiceVersion {
  79. return kGDataWebmasterToolsDefaultServiceVersion;
  80. }
  81. #pragma mark -
  82. - (NSString *)sitemapStatus {
  83. GDataSitemapStatus *obj;
  84. obj = [self objectForExtensionClass:[GDataSitemapStatus class]];
  85. return [obj stringValue];
  86. }
  87. - (void)setSitemapStatus:(NSString *)str {
  88. GDataSitemapStatus *obj = [GDataSitemapStatus valueWithString:str];
  89. [self setObject:obj forExtensionClass:[GDataSitemapStatus class]];
  90. }
  91. - (GDataDateTime *)lastDownloadDate {
  92. GDataSitemapLastDownloaded *obj;
  93. obj = [self objectForExtensionClass:[GDataSitemapLastDownloaded class]];
  94. return [obj dateTimeValue];
  95. }
  96. - (void)setLastDownloadDate:(GDataDateTime *)dateTime {
  97. GDataSitemapLastDownloaded *obj;
  98. obj = [GDataSitemapLastDownloaded valueWithDateTime:dateTime];
  99. [self setObject:obj forExtensionClass:[GDataSitemapLastDownloaded class]];
  100. }
  101. - (NSNumber *)sitemapURLCount {
  102. GDataSitemapURLCount *obj;
  103. obj = [self objectForExtensionClass:[GDataSitemapURLCount class]];
  104. return [obj intNumberValue];
  105. }
  106. - (void)setSitemapURLCount:(NSNumber *)num {
  107. GDataSitemapURLCount *obj = nil;
  108. if (num != nil) {
  109. obj = [GDataSitemapURLCount valueWithNumber:num];
  110. }
  111. [self setObject:obj forExtensionClass:[GDataSitemapURLCount class]];
  112. }
  113. @end
  114. @implementation GDataEntrySitemapRegular
  115. + (NSString *)standardEntryKind {
  116. return kGDataCategorySitemapRegular;
  117. }
  118. + (void)load {
  119. [self registerEntryClass];
  120. }
  121. #if !GDATA_SIMPLE_DESCRIPTIONS
  122. - (NSMutableArray *)itemsForDescription {
  123. NSMutableArray *items = [super itemsForDescription];
  124. [self addToArray:items objectDescriptionIfNonNil:[self sitemapType] withName:@"sitemapType"];
  125. return items;
  126. }
  127. #endif
  128. - (void)addExtensionDeclarations {
  129. [super addExtensionDeclarations];
  130. [self addExtensionDeclarationForParentClass:[self class]
  131. childClass:[GDataSitemapType class]];
  132. }
  133. #pragma mark -
  134. - (NSString *)sitemapType {
  135. GDataSitemapType *obj;
  136. obj = [self objectForExtensionClass:[GDataSitemapType class]];
  137. return [obj stringValue];
  138. }
  139. - (void)setSitemapType:(NSString *)str {
  140. GDataSitemapType *obj = nil;
  141. if (str != nil) {
  142. obj = [GDataSitemapType valueWithString:str];
  143. }
  144. [self setObject:obj forExtensionClass:[GDataSitemapType class]];
  145. }
  146. @end
  147. @implementation GDataEntrySitemapMobile
  148. + (NSString *)standardEntryKind {
  149. return kGDataCategorySitemapMobile;
  150. }
  151. + (void)load {
  152. [self registerEntryClass];
  153. }
  154. - (void)addExtensionDeclarations {
  155. [super addExtensionDeclarations];
  156. [self addExtensionDeclarationForParentClass:[self class]
  157. childClass:[GDataSitemapMobileMarkupLanguage class]];
  158. }
  159. #if !GDATA_SIMPLE_DESCRIPTIONS
  160. - (NSMutableArray *)itemsForDescription {
  161. NSMutableArray *items = [super itemsForDescription];
  162. [self addToArray:items objectDescriptionIfNonNil:[self markupLanguage] withName:@"markupLang"];
  163. return items;
  164. }
  165. #endif
  166. #pragma mark -
  167. - (NSString *)markupLanguage {
  168. GDataSitemapMobileMarkupLanguage *obj;
  169. obj = [self objectForExtensionClass:[GDataSitemapMobileMarkupLanguage class]];
  170. return [obj stringValue];
  171. }
  172. - (void)setMarkupLanguage:(NSString *)str {
  173. GDataSitemapMobileMarkupLanguage *obj = nil;
  174. if (str != nil) {
  175. obj = [GDataSitemapMobileMarkupLanguage valueWithString:str];
  176. }
  177. [self setObject:obj forExtensionClass:[GDataSitemapMobileMarkupLanguage class]];
  178. }
  179. @end
  180. @implementation GDataEntrySitemapNews
  181. + (NSString *)standardEntryKind {
  182. return kGDataCategorySitemapNews;
  183. }
  184. + (void)load {
  185. [self registerEntryClass];
  186. }
  187. - (void)addExtensionDeclarations {
  188. [super addExtensionDeclarations];
  189. [self addExtensionDeclarationForParentClass:[self class]
  190. childClass:[GDataSitemapNewsPublicationLabel class]];
  191. }
  192. #if !GDATA_SIMPLE_DESCRIPTIONS
  193. - (NSMutableArray *)itemsForDescription {
  194. NSMutableArray *items = [super itemsForDescription];
  195. [self addToArray:items objectDescriptionIfNonNil:[self publicationLabel] withName:@"pubLabel"];
  196. return items;
  197. }
  198. #endif
  199. #pragma mark -
  200. - (NSString *)publicationLabel {
  201. GDataSitemapNewsPublicationLabel *obj;
  202. obj = [self objectForExtensionClass:[GDataSitemapNewsPublicationLabel class]];
  203. return [obj stringValue];
  204. }
  205. - (void)setPublicationLabel:(NSString *)str {
  206. GDataSitemapNewsPublicationLabel *obj = nil;
  207. if (str != nil) {
  208. obj = [GDataSitemapNewsPublicationLabel valueWithString:str];
  209. }
  210. [self setObject:obj forExtensionClass:[GDataSitemapNewsPublicationLabel class]];
  211. }
  212. @end
  213. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE