PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/DotNetSlave.BusinessLogic/Providers/BlogProvider.cs

#
C# | 417 lines | 67 code | 51 blank | 299 comment | 0 complexity | 866e7f27d3c3c1e36b9919442c29ce8d MD5 | raw file
  1namespace BlogEngine.Core.Providers
  2{
  3    using System;
  4    using System.Collections.Generic;
  5    using System.Collections.Specialized;
  6    using System.Configuration.Provider;
  7
  8    using DataStore;
  9    using Packaging;
 10
 11    /// <summary>
 12    /// A base class for all custom providers to inherit from.
 13    /// </summary>
 14    public abstract class BlogProvider : ProviderBase
 15    {
 16        // Post
 17        #region Public Methods
 18
 19        /// <summary>
 20        /// Deletes a BlogRoll from the data store specified by the provider.
 21        /// </summary>
 22        /// <param name="blogRollItem">
 23        /// The blog Roll Item to delete.
 24        /// </param>
 25        public abstract void DeleteBlogRollItem(BlogRollItem blogRollItem);
 26
 27        /// <summary>
 28        /// Deletes a Blog from the data store specified by the provider.
 29        /// </summary>
 30        /// <param name="blog">
 31        /// The blog to delete.
 32        /// </param>
 33        public abstract void DeleteBlog(Blog blog);
 34
 35        /// <summary>
 36        /// Deletes a Blog's storage container from the data store specified by the provider.
 37        /// </summary>
 38        /// <param name="blog">
 39        /// The blog to delete the storage container of.
 40        /// </param>
 41        public abstract bool DeleteBlogStorageContainer(Blog blog);
 42
 43        /// <summary>
 44        /// Deletes a Category from the data store specified by the provider.
 45        /// </summary>
 46        /// <param name="category">
 47        /// The category to delete.
 48        /// </param>
 49        public abstract void DeleteCategory(Category category);
 50
 51        /// <summary>
 52        /// Deletes a Page from the data store specified by the provider.
 53        /// </summary>
 54        /// <param name="page">
 55        /// The page to delete.
 56        /// </param>
 57        public abstract void DeletePage(Page page);
 58
 59        /// <summary>
 60        /// Deletes a Post from the data store specified by the provider.
 61        /// </summary>
 62        /// <param name="post">
 63        /// The post to delete.
 64        /// </param>
 65        public abstract void DeletePost(Post post);
 66
 67        /// <summary>
 68        /// Deletes a Page from the data store specified by the provider.
 69        /// </summary>
 70        /// <param name="profile">
 71        /// The profile to delete.
 72        /// </param>
 73        public abstract void DeleteProfile(AuthorProfile profile);
 74
 75        /// <summary>
 76        /// Retrieves all BlogRolls from the provider and returns them in a list.
 77        /// </summary>
 78        /// <returns>A list of BlogRollItem.</returns>
 79        public abstract List<BlogRollItem> FillBlogRoll();
 80
 81        /// <summary>
 82        /// Retrieves all Blogs from the provider and returns them in a list.
 83        /// </summary>
 84        /// <returns>A list of Blogs.</returns>
 85        public abstract List<Blog> FillBlogs();
 86
 87        /// <summary>
 88        /// Retrieves all Categories from the provider and returns them in a List.
 89        /// </summary>
 90        /// <returns>A list of Category.</returns>
 91        public abstract List<Category> FillCategories();
 92
 93        /// <summary>
 94        /// Retrieves all Pages from the provider and returns them in a List.
 95        /// </summary>
 96        /// <returns>A list of Page.</returns>
 97        public abstract List<Page> FillPages();
 98
 99        /// <summary>
100        /// Retrieves all Posts from the provider and returns them in a List.
101        /// </summary>
102        /// <returns>A list of Post.</returns>
103        public abstract List<Post> FillPosts();
104
105        /// <summary>
106        /// Retrieves all Pages from the provider and returns them in a List.
107        /// </summary>
108        /// <returns>A list of AuthorProfile.</returns>
109        public abstract List<AuthorProfile> FillProfiles();
110
111        /// <summary>
112        /// Deletes a Referrer from the data store specified by the provider.
113        /// </summary>
114        /// <returns>A list of Referrer.</returns>
115        public abstract List<Referrer> FillReferrers();
116
117        /// <summary>
118        /// Returns a dictionary representing rights and the roles that allow them.
119        /// </summary>
120        /// <returns>
121        /// 
122        /// The key must be a string of the name of the Rights enum of the represented Right.
123        /// The value must be an IEnumerable of strings that includes only the role names of
124        /// roles the right represents.
125        /// 
126        /// Inheritors do not need to worry about verifying that the keys and values are valid.
127        /// This is handled in the Right class.
128        /// 
129        /// </returns>
130        public abstract IDictionary<string, IEnumerable<String>> FillRights();
131
132        /// <summary>
133        /// Inserts a new BlogRoll into the data store specified by the provider.
134        /// </summary>
135        /// <param name="blogRollItem">
136        /// The blog Roll Item.
137        /// </param>
138        public abstract void InsertBlogRollItem(BlogRollItem blogRollItem);
139
140        /// <summary>
141        /// Inserts a new Blog into the data store specified by the provider.
142        /// </summary>
143        /// <param name="blog">
144        /// The blog.
145        /// </param>
146        public abstract void InsertBlog(Blog blog);
147
148        /// <summary>
149        /// Inserts a new Category into the data store specified by the provider.
150        /// </summary>
151        /// <param name="category">
152        /// The category.
153        /// </param>
154        public abstract void InsertCategory(Category category);
155
156        /// <summary>
157        /// Inserts a new Page into the data store specified by the provider.
158        /// </summary>
159        /// <param name="page">
160        /// The page to insert.
161        /// </param>
162        public abstract void InsertPage(Page page);
163
164        /// <summary>
165        /// Inserts a new Post into the data store specified by the provider.
166        /// </summary>
167        /// <param name="post">
168        /// The post to insert.
169        /// </param>
170        public abstract void InsertPost(Post post);
171
172        /// <summary>
173        /// Inserts a new Page into the data store specified by the provider.
174        /// </summary>
175        /// <param name="profile">
176        /// The profile to insert.
177        /// </param>
178        public abstract void InsertProfile(AuthorProfile profile);
179
180        /// <summary>
181        /// Inserts a new Referrer into the data store specified by the provider.
182        /// </summary>
183        /// <param name="referrer">
184        /// The referrer to insert.
185        /// </param>
186        public abstract void InsertReferrer(Referrer referrer);
187
188        /// <summary>
189        /// Loads settings from data store
190        /// </summary>
191        /// <param name="extensionType">
192        /// Extension Type
193        /// </param>
194        /// <param name="extensionId">
195        /// Extensio Id
196        /// </param>
197        /// <returns>
198        /// Settings as stream
199        /// </returns>
200        public abstract object LoadFromDataStore(ExtensionType extensionType, string extensionId);
201
202        /// <summary>
203        /// Loads the ping services.
204        /// </summary>
205        /// <returns>
206        /// A StringCollection.
207        /// </returns>
208        public abstract StringCollection LoadPingServices();
209
210        /// <summary>
211        /// Loads the settings from the provider.
212        /// </summary>
213        /// <returns>A StringDictionary.</returns>
214        public abstract StringDictionary LoadSettings();
215
216        /// <summary>
217        /// Loads the stop words used in the search feature.
218        /// </summary>
219        /// <returns>
220        /// A StringCollection.
221        /// </returns>
222        public abstract StringCollection LoadStopWords();
223
224        /// <summary>
225        /// Removes settings from data store
226        /// </summary>
227        /// <param name="extensionType">
228        /// Extension Type
229        /// </param>
230        /// <param name="extensionId">
231        /// Extension Id
232        /// </param>
233        public abstract void RemoveFromDataStore(ExtensionType extensionType, string extensionId);
234
235        /// <summary>
236        /// Saves the ping services.
237        /// </summary>
238        /// <param name="services">
239        /// The services.
240        /// </param>
241        public abstract void SavePingServices(StringCollection services);
242
243        /// <summary>
244        /// Saves all of the Rights and the roles that coorespond with them.
245        /// </summary>
246        /// <param name="rights"></param>
247        public abstract void SaveRights(IEnumerable<Right> rights);
248
249        /// <summary>
250        /// Saves the settings to the provider.
251        /// </summary>
252        /// <param name="settings">
253        /// The settings.
254        /// </param>
255        public abstract void SaveSettings(StringDictionary settings);
256
257        /// <summary>
258        /// Saves settings to data store
259        /// </summary>
260        /// <param name="extensionType">
261        /// Extension Type
262        /// </param>
263        /// <param name="extensionId">
264        /// Extension Id
265        /// </param>
266        /// <param name="settings">
267        /// Settings object
268        /// </param>
269        public abstract void SaveToDataStore(ExtensionType extensionType, string extensionId, object settings);
270
271        /// <summary>
272        /// Retrieves a BlogRoll from the provider based on the specified id.
273        /// </summary>
274        /// <param name="id">The Blog Roll Item Id.</param>
275        /// <returns>A BlogRollItem.</returns>
276        public abstract BlogRollItem SelectBlogRollItem(Guid id);
277
278        /// <summary>
279        /// Retrieves a Blog from the provider based on the specified id.
280        /// </summary>
281        /// <param name="id">The Blog Id.</param>
282        /// <returns>A Blog.</returns>
283        public abstract Blog SelectBlog(Guid id);
284
285        /// <summary>
286        /// Retrieves a Category from the provider based on the specified id.
287        /// </summary>
288        /// <param name="id">The Category id.</param>
289        /// <returns>A Category.</returns>
290        public abstract Category SelectCategory(Guid id);
291
292        /// <summary>
293        /// Retrieves a Page from the provider based on the specified id.
294        /// </summary>
295        /// <param name="id">The Page id.</param>
296        /// <returns>The Page object.</returns>
297        public abstract Page SelectPage(Guid id);
298
299        /// <summary>
300        /// Retrieves a Post from the provider based on the specified id.
301        /// </summary>
302        /// <param name="id">The Post id.</param>
303        /// <returns>A Post object.</returns>
304        public abstract Post SelectPost(Guid id);
305
306        /// <summary>
307        /// Retrieves a Page from the provider based on the specified id.
308        /// </summary>
309        /// <param name="id">The AuthorProfile id.</param>
310        /// <returns>An AuthorProfile.</returns>
311        public abstract AuthorProfile SelectProfile(string id);
312
313        /// <summary>
314        /// Retrieves a Referrer from the provider based on the specified id.
315        /// </summary>
316        /// <param name="id">The Referrer Id.</param>
317        /// <returns>A Referrer.</returns>
318        public abstract Referrer SelectReferrer(Guid id);
319
320        /// <summary>
321        /// Sets up the required storage files/tables for a new Blog instance, from an existing blog instance.
322        /// </summary>
323        /// <param name="existingBlog">The existing blog instance to base the new blog instance off of.</param>
324        /// <param name="newBlog">The new blog instance.</param>
325        /// <returns>A boolean indicating if the setup process was successful.</returns>
326        public abstract bool SetupBlogFromExistingBlog(Blog existingBlog, Blog newBlog);
327
328        /// <summary>
329        /// Updates an existing BlogRollItem in the data store specified by the provider.
330        /// </summary>
331        /// <param name="blogRollItem">
332        /// The blogroll item to update.
333        /// </param>
334        public abstract void UpdateBlogRollItem(BlogRollItem blogRollItem);
335
336        /// <summary>
337        /// Updates an existing Blog in the data store specified by the provider.
338        /// </summary>
339        /// <param name="blog">
340        /// The blog to update.
341        /// </param>
342        public abstract void UpdateBlog(Blog blog);
343
344        /// <summary>
345        /// Updates an existing Category in the data store specified by the provider.
346        /// </summary>
347        /// <param name="category">
348        /// The category to update.
349        /// </param>
350        public abstract void UpdateCategory(Category category);
351
352        /// <summary>
353        /// Updates an existing Page in the data store specified by the provider.
354        /// </summary>
355        /// <param name="page">
356        /// The page to update.
357        /// </param>
358        public abstract void UpdatePage(Page page);
359
360        /// <summary>
361        /// Updates an existing Post in the data store specified by the provider.
362        /// </summary>
363        /// <param name="post">
364        /// The post to update.
365        /// </param>
366        public abstract void UpdatePost(Post post);
367
368        /// <summary>
369        /// Updates an existing Page in the data store specified by the provider.
370        /// </summary>
371        /// <param name="profile">
372        /// The profile to update.
373        /// </param>
374        public abstract void UpdateProfile(AuthorProfile profile);
375
376        /// <summary>
377        /// Updates an existing Referrer in the data store specified by the provider.
378        /// </summary>
379        /// <param name="referrer">
380        /// The referrer to update.
381        /// </param>
382        public abstract void UpdateReferrer(Referrer referrer);
383
384        #region Packaging
385        /// <summary>
386        /// Save installed package id and version
387        /// </summary>
388        /// <param name="package">Intalled package</param>
389        public abstract void SavePackage(InstalledPackage package);
390        /// <summary>
391        /// Log of all files for installed package
392        /// </summary>
393        /// <param name="packageFiles">List of intalled package files</param>
394        public abstract void SavePackageFiles(List<PackageFile> packageFiles);
395        /// <summary>
396        /// Gets list of files for installed package
397        /// </summary>
398        /// <param name="packageId">Package ID</param>
399        /// <returns>List of files for installed package</returns>
400        public abstract List<PackageFile> FillPackageFiles(string packageId);
401        /// <summary>
402        /// Gets all installed from gallery packages
403        /// </summary>
404        /// <returns>List of installed packages</returns>
405        public abstract List<InstalledPackage> FillPackages();
406        /// <summary>
407        /// Should delete package and remove all package files
408        /// </summary>
409        /// <param name="packageId">Package ID</param>
410        /// <param name="version">Version</param>
411        public abstract void DeletePackage(string packageId);
412
413        #endregion
414
415        #endregion
416    }
417}