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