/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Data;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Everest.CmsServices.Models;
using Everest.CmsServices.Search;
namespace Everest.CmsServices.Providers{
public enum QueryType
{
All,
Published,
Unpublished,
}
public interface ITextContentQuerier
{
/// <summary>
/// Sets the type of the query.
/// </summary>
/// <param name="queryType">Type of the query.</param>
/// <returns></returns>
ITextContentQuerier SetQueryType(QueryType queryType);
#region QueryContents
/// <summary>
/// query the content.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="schema">The schema. Some contents are not in folder..</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
IDictionary<string, object> QueryContent(IEverestCmsDataContext dataContext, Cms_Schema schema, string queryStatement
, string orderBy, IDictionary<string, object> parameterValues, TimeSpan? cacheTime);
/// <summary>
/// Queries the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.The statement like : id={id} and name like '%name%'</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryContents(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Folder folder, IEnumerable<Cms_Folder> folders, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.The statement like : id={id} and name like '%name%'</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <returns></returns>
int CountContents(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues,
Cms_Folder folder, IEnumerable<Cms_Folder> folders, TimeSpan? cacheTime);
#endregion
#region QuerySubContents
/// <summary>
/// Queries the sub contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="schema">The schema.</param>
/// <param name="parentId">The parent id.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QuerySubContents(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Schema schema, Guid? parentUUID, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the sub contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="schema">The schema.</param>
/// <param name="parentId">The parent id.</param>
/// <returns></returns>
int CountSubContents(IEverestCmsDataContext dataContext, string queryStatement,
IDictionary<string, object> parameterValues, Cms_Schema schema, Guid? parentUUID, TimeSpan? cacheTime);
#endregion
#region QueryReferToContents Query content by category
/// <summary>
/// Queries the contents by category.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="schema">The schema.</param>
/// <param name="categories">The categories.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryContentsByCategory(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Schema schema, IEnumerable<Guid> categories, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the counts by category.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="schema">The schema.</param>
/// <param name="categories">The categories.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
int CountContentsByCategory(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues, Cms_Schema schema,
IEnumerable<Guid> categories, TimeSpan? cacheTime);
/// <summary>
/// Queries the contents by category.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="categories">The categories.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryContentsByCategory(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,IDictionary<string, object> parameterValues,
Cms_Folder folder, IEnumerable<Cms_Folder> folders, IEnumerable<Guid> categories, int startIndex, int limit, TimeSpan? cacheTime);
int CountContentsByCategory(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues, Cms_Folder folder,
IEnumerable<Cms_Folder> folders, IEnumerable<Guid> categories, TimeSpan? cacheTime);
#endregion
#region QueryReferredByContents. Query categories.
/// <summary>
/// Queries the categories.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="schema">The schema.</param>
/// <param name="referToContentUUID">The refer to content UUID.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryCategories(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Schema schema, Guid referToContentUUID, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the category.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="schema">The schema.</param>
/// <param name="referToContentUUID">The refer to content UUID.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
int CountCategories(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues, Cms_Schema schema,
Guid referToContentUUID, TimeSpan? cacheTime);
/// <summary>
/// Queries the categories.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="ReferToContentUUID">The refer to content UUID.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryCategories(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Folder folder, IEnumerable<Cms_Folder> folders, Guid ReferToContentUUID
, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the referred by counts.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="referToContentUUID">The refer to content UUID.</param>
/// <param name="cacheTime">The cache time.</param>
/// <returns></returns>
int CountCategories(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues, Cms_Folder folder,
IEnumerable<Cms_Folder> folders, Guid referToContentUUID, TimeSpan? cacheTime);
#endregion
//#region QueryBySubContent
///// <summary>
///// Queries the content of the by sub.
///// </summary>
///// <param name="dataContext">The data context.</param>
///// <param name="folder">The folder.</param>
///// <param name="parentCondition">The parent condition.</param>
///// <param name="orderBy">The order by.</param>
///// <param name="parentParameters">The parent parameters.</param>
///// <param name="subSchema">The sub schema.</param>
///// <param name="subContentCondition">The sub content condition.</param>
///// <param name="subParameters">The sub parameters.</param>
///// <param name="startIndex">The start index.</param>
///// <param name="limit">The limit.</param>
///// <param name="cacheTime">The cache time.</param>
///// <returns></returns>
//IEnumerable<IDictionary<string, object>> QueryBySubContent(IEverestCmsDataContext dataContext, Cms_Folder folder, string parentCondition, string orderBy,
// IDictionary<string, object> parentParameters, Cms_Schema subSchema, string subContentCondition, IDictionary<string, object> subParameters,
// int startIndex, int limit);
///// <summary>
///// Counts the content of the by sub.
///// </summary>
///// <param name="dataContext">The data context.</param>
///// <param name="folder">The folder.</param>
///// <param name="parentCondition">The parent condition.</param>
///// <param name="parentParameters">The parent parameters.</param>
///// <param name="subSchema">The sub schema.</param>
///// <param name="subContentCondition">The sub content condition.</param>
///// <param name="subParameters">The sub parameters.</param>
///// <param name="cacheTime">The cache time.</param>
///// <returns></returns>
//int CountBySubContent(IEverestCmsDataContext dataContext, Cms_Folder folder, string parentCondition, IDictionary<string, object> parentParameters,
// Cms_Schema subSchema, string subContentCondition, IDictionary<string, object> subParameters);
//#endregion
}
public interface ITextContentManager
{
/// <summary>
/// Creates the schema.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="schema">The schema.</param>
void CreateSchema(IEverestCmsDataContext dataContext, Cms_Schema schema);
/// <summary>
/// Deletes the schema.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="schema">The schema.</param>
void DeleteSchema(IEverestCmsDataContext dataContext, Cms_Schema schema);
/// <summary>
/// Updates the schema.
/// </summary>
/// <param name="schema">The schema.</param>
/// <param name="olderSchema">The older schema.</param>
/// <param name="olderColumns">The older columns.</param>
void UpdateSchema(IEverestCmsDataContext dataContext, Cms_Schema schema, string olderSchema, List<Cms_Column> olderColumns);
/// <summary>
/// Deletes the contents by folder.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="folder">The folder.</param>
void DeleteContentsByFolder(IEverestCmsDataContext dataContext, Cms_Folder folder);
/// <summary>
/// Creates the content.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="contentValues">The content values.</param>
/// <returns>Return the cotnent field values</returns>
IDictionary<string, object> CreateContent(IEverestCmsDataContext dataContext, Cms_Content content, IDictionary<string, object> contentValues);
/// <summary>
/// Copies the content.
/// </summary>
/// <param name="originalContent">Content of the original.</param>
/// <param name="newContentId">The new content id.</param>
void CopyContent(IEverestCmsDataContext dataContext, Cms_Content originalContent, Cms_Content newContent);
/// <summary>
/// Updates the content.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="content">The content.</param>
/// <param name="newContentValues">The new content values.</param>
/// <param name="updateAllField">if set to <c>true</c> [update all field].</param>
/// <returns>Return the cotnent field values</returns>
IDictionary<string, object> UpdateContent(IEverestCmsDataContext dataContext, Cms_Content content, IDictionary<string, object> newContentValues, bool updateAllField);
/// <summary>
/// Deletes the content.
/// </summary>
/// <param name="content">The content.</param>
void DeleteContent(IEverestCmsDataContext dataContext, Cms_Content content);
/// <summary>
/// Queries the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="userName">Name of the user.</param>
/// <param name="isProcessed">The is processed.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryContents(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Folder folder, IEnumerable<Cms_Folder> folders, string userName,
bool? isProcessed, int startIndex, int limit);
/// <summary>
/// Counts the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="userName">Name of the user.</param>
/// <param name="isProcessed">The is processed.</param>
/// <returns></returns>
int CountContents(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues,
Cms_Folder folder, IEnumerable<Cms_Folder> folders, string userName, bool? isProcessed);
/// <summary>
/// Gets the content.
/// </summary>
/// <param name="content">The content.</param>
/// <returns></returns>
IDictionary<string, object> QueryContent(IEverestCmsDataContext dataContext, Cms_Content content);
}
public interface IBinaryContentQuerier
{
/// <summary>
/// Sets the type of the query.
/// </summary>
/// <param name="queryType">Type of the query.</param>
/// <returns></returns>
IBinaryContentQuerier SetQueryType(QueryType queryType);
IDictionary<string, object> QueryContent(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, TimeSpan? cacheTime);
/// <summary>
/// Queries the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.The statement like : id={id} and name like '%name%'</param>
/// <param name="orderBy">The order by.</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <param name="startIndex">The start index.</param>
/// <param name="limit">The limit.</param>
/// <returns></returns>
IEnumerable<IDictionary<string, object>> QueryContents(IEverestCmsDataContext dataContext, string queryStatement, string orderBy,
IDictionary<string, object> parameterValues, Cms_Folder folder, IEnumerable<Cms_Folder> folders, int startIndex, int limit, TimeSpan? cacheTime);
/// <summary>
/// Counts the contents.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="queryStatement">The query statement.The statement like : id={id} and name like '%name%'</param>
/// <param name="parameterValues">The query string.</param>
/// <param name="folder">The folder.</param>
/// <param name="folders">The folders.</param>
/// <returns></returns>
int CountContents(IEverestCmsDataContext dataContext, string queryStatement, IDictionary<string, object> parameterValues,
Cms_Folder folder, IEnumerable<Cms_Folder> folders, TimeSpan? cacheTime);
}
public interface IBinaryContentManager
{
IEnumerable<IDictionary<string, object>> QueryContents(IEverestCmsDataContext dataContext, Cms_Folder folder, IEnumerable<Cms_Folder> folders
, string queryStatement, IDictionary<string, object> parameterValues, string userName, bool? isProcessed, string orderBy, int startIndex, int limit);
int CountContents(IEverestCmsDataContext dataContext, Cms_Folder folder, IEnumerable<Cms_Folder> folders, string queryStatement, IDictionary<string, object> parameterValues,
string userName, bool? isProcessed);
}
public interface ISystemManager
{
/// <summary>
/// Deletes the application.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="app">The app.</param>
void DeleteApplication(IEverestCmsDataContext dataContext, string app);
/// <summary>
/// Includes the folder items.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="folderUUID">The folder UUID.</param>
/// <param name="baseFolderUUID">The base folder UUID.</param>
void IncludeFolderItems(IEverestCmsDataContext dataContext, Guid folderUUID, Guid baseFolderUUID);
/// <summary>
/// Adds the index of the content.
/// </summary>
/// <param name="dataContext">The data context.</param>
/// <param name="applicationName">Name of the application.</param>
/// <param name="indexType">Type of the index.</param>
void AddContentIndex(IEverestCmsDataContext dataContext, string applicationName, IndexType indexType);
/// <summary>
/// Exports the design.
/// </summary>
/// <param name="application">The application.</param>
/// <returns></returns>
string ExportSiteElementData(string application);
/// <summary>
/// Exports the content data.
/// </summary>
/// <param name="application">The application.</param>
/// <returns></returns>
string ExportContentData(string application);
//void EnsureDatabaseInitialized(IEverestCmsDataContext dataContext);
}
/// <summary>
///
/// </summary>
public interface IContentProvider
{
ITextContentQuerier TextContentQuerier { get; }
ITextContentManager TextContentManager { get; }
IBinaryContentManager BinaryContentManager { get; }
IBinaryContentQuerier BinaryContentQuerier { get; }
ISystemManager SystemManager { get; }
}
}
|