/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System.Collections; using System.Windows.Forms; namespace JetBrains.Omea.OpenAPI { /// /// Plugins should implement this interface if they need to register /// task-specific conditions, views or rules. /// public interface IViewsConstructor { /// /// Method is called when a plugin that implements this interface is loaded first time. /// void RegisterViewsFirstRun(); /// /// Method is called when a plugin that implements this interface is loaded. /// Usually this method contains code which creates rule actions and performs /// corrections to the resources created during the first start of the plugin. /// void RegisterViewsEachRun(); } /// /// Enumeration lists all possible operations supported by the FilterRegistry. /// Possible operations are descibed below. /// public enum ConditionOp { /// /// A property value (of value type, not a resource link) must be equal to the value given in the values list; /// Eq = 10, /// /// A property value (of value type, not a resource link) must be less than the value given in the values list; /// Lt = 20, /// /// A property value (of value type, not a resource link) must be greater than the value given in the values list; /// Gt = 30, /// /// A link value must refer to the resource object given in the values list; /// In = 40, /// /// Reserved; /// Has = 50, /// /// A property value (of value type, not a resource link) must be in the interval of the lower and upper margin given in the values list /// (as first and last value correspondingly); /// InRange = 60, /// /// A resource must have a link given in the propName parameter; /// HasLink = 70, /// /// A resource must have a property given in the propName parameter; /// HasProp = 80, /// /// A resource must not have a property given in the propName parameter; /// HasNoProp = 85, /// /// A resource must match query condition given in the propName parameter. /// QueryMatch = 90 }; /// /// Specifies the names of standard events in the system. /// /// 556 public class StandardEvents { public const string ResourceReceived = "A resource is received"; public const string CategoryAssigned = "A category is assigned"; } /// /// Provides services related to custom views, rules, conditions and rule actions. /// public interface IFilterRegistry { #region Conditions /// /// Create standard condition anew, old condition with such name is removed, all links to /// the old condition are invalidated. /// /// Name of a condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which condition is applicable (null if the condition can be applied to all resource types). /// Name of a property which participates in condition evaluation. /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created condition. /// Overload which uses an array of resource /// objects as operation parameters (for In operation). IResource RecreateStandardCondition( string name, string deepName, string[] resTypes, string propName, ConditionOp op, params string[] values ); /// /// Create standard condition anew, old condition with such name is removed, all links to /// the old condition are invalidated. /// /// Name of a condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which condition is applicable (null if the condition can be applied to all resource types). /// Name of a property which participates in condition evaluation. /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created condition. /// Overload which uses an array of strings /// as operation parameters. IResource RecreateStandardCondition( string name, string deepName, string[] resTypes, string propName, ConditionOp op, IResourceList values ); /// /// Create standard condition if it does not exist otherwise return the existing condition. /// /// Name of a condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource types for which condition is applicable (null if the condition can be applied to all resource types). /// Name of a property which participates in condition evaluation. /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created condition. /// Overload which uses an array of resource /// objects as operation parameters (for In operation). IResource CreateStandardCondition( string name, string deepName, string[] resTypes, string propName, ConditionOp op, params string[] values ); /// /// Create standard condition if it does not exist otherwise return the existing condition. /// /// Name of a condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource types for which condition is applicable (null if the condition can be applied to all resource types). /// Name of a property which participates in condition evaluation. /// Condition operation. /// Set of resource parameters (operation-dependent). /// Resource representing the created condition. /// Overload which uses an array of /// strings as operation parameters. IResource CreateStandardCondition( string name, string deepName, string[] resTypes, string propName, ConditionOp op, IResourceList values ); /// /// Create query condition if it does not exist otherwise return the existing condition. This method is a shortcut of the more /// general method . /// /// Name of a query condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource types for which condition is applicable (null if the condition can be applied to all resource types). /// Search query to the text index. /// [Optional] Name of a document section in which the search must be performed. /// Resource representing the created condition. /// Method which always creates new query condition and /// removes the existing condition with such name. IResource CreateQueryCondition( string name, string deepName, string[] resTypes, string query, string sectionName ); /// /// Create query condition, remove old query condition with the same name. This method is a shortcut of the more /// general method . /// /// Name of a query condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource types for which condition is applicable (null if the condition can be applied to all resource types). /// Search query to the text index. /// [Optional] Name of a document section in which the search must be performed. /// Resource representing the created condition. /// Method which always creates new query condition and /// removes the existing condition with such name. IResource RecreateQueryCondition( string name, string deepName, string[] resTypes, string query, string sectionName ); /// /// Register custom condition object. /// /// Name of a condition. /// Deep name of a condition - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which template is applicable (null if the template can be applied to all resource types). /// An object implementing ICustomCondition interface. /// Resource representing the created condition. IResource RegisterCustomCondition( string name, string deepName, string[] resTypes, ICustomCondition filter ); #endregion Conditions #region Conditions Templates IResource CreateCustomConditionTemplate( string name, string deepName, string[] resTypes, ICustomConditionTemplate filter, ConditionOp op, params string[] values ); /// /// Create standard condition template anew, old template with such name is removed, all links to /// the old template are invalidated. /// /// Name of a condition. /// Deep name of a template - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which template is applicable (null if the template can be applied to all resource types). /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created template. IResource RecreateConditionTemplate( string name, string deepName, string[] resTypes, ConditionOp op, params string[] values ); /// /// Create standard condition template if there is no with such name, return existing template otherwise. /// /// Name of a condition template. /// Deep name of a template - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which template is applicable (null if the template can be applied to all resource types). /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created template. IResource CreateConditionTemplate( string name, string deepName, string[] resTypes, ConditionOp op, params string[] values ); /// /// Create a condition template with UI handler anew, old template with such name is removed, all links to /// the old template are invalidated. UI handlers are the means to visually represent and accept condition /// template parameters, when e.g. they have a special semantics which differs from the parameter's original type. /// /// Name of a condition. /// Deep name of a template - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which template is applicable (null if the template can be applied to all resource types). /// An instance of ITemplateParamUIHandler interface, implementing visual /// representation of the parameter's value and semantics. /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created template. IResource RecreateConditionTemplateWithUIHandler( string name, string deepName, string[] resTypes, ITemplateParamUIHandler handler, ConditionOp op, params string[] values ); /// /// Create a condition template with UI handler if there is no with such name, return existing template otherwise. /// UI handlers are the means to visually represent and accept condition template parameters, /// when e.g. they have a special semantics which differs from the parameter's original type. /// /// Name of a condition. /// Deep name of a template - a name which is permanent independently of /// potential condition renamings and translations. All conditions are identified using deep names, /// not display ones. /// A set of resource type names for which template is applicable (null if the template can be applied to all resource types). /// An instance of ITemplateParamUIHandler interface, implementing visual /// representation of the parameter's value and semantics. /// Condition operation. /// Set of string parameters (operation-dependent). /// Resource representing the created template. IResource CreateConditionTemplateWithUIHandler( string name, string deepName, string[] resTypes, ITemplateParamUIHandler handler, ConditionOp op, params string[] values ); /// /// Create a proxy rule condition (exception) from a condition template /// by instantiating of template with necessary typed parameter. Link /// condition and template for subsequent modifications. /// /// A resource representing a condition template. /// Parameter for instantiation. /// An array of resource types for which the condition is valid. /// A resource representing an proxy condition. /// 428 IResource InstantiateConditionTemplate( IResource template, object param, string[] resTypes ); #endregion Conditions Templates #region Operations over Conditions /// /// Makes a condition usable only for rules matching. This prohibits it /// from using in views. /// /// Resource representing a condition. void MarkConditionOnlyForRule( IResource condition ); /// /// Ascribes a condition to a group. These groups divide conditions into /// meaningful groups, which are represented as folders in /// Choose Condition/Exception dialog. /// /// Resource representing a condition. /// Name of a group. void AssociateConditionWithGroup( IResource condition, string groupName ); #endregion Operations over Conditions #region Folders /// /// Create new view folder and link it to the base view folder. Method does /// not create new view folder if there is already exists one with such name, /// but always performs linking with bas view folder. If base folder does not /// exist, methods creates new one with the given name and links it to the /// root folder with the order 0. /// /// Name of folder. /// Name of base folder. If parameter is null, root folder is used. /// Order of a view under the root. /// Resource representing view folder. /// 379 IResource CreateViewFolder( string name, string baseFolderName, int order ); /// /// Associate a view with a folder, that is a view will be placed into that folder in /// the tree of views and categories resources. /// /// A resource representing a view. /// Name of a view folder. Set to NULL if ResourceTreeRoot is a target. /// If folder is not the ResourceTreeRoot, it must already exist. /// Order of a view within a sequence of views under the same view folder. /// 410 void AssociateViewWithFolder( IResource view, string folderName, int order ); #endregion Folders #region Views /// /// Register a view with the given set of conditions and exceptions. /// It returns the existing view with such name and creates new view otherwise. /// /// Name of a view. /// Set of conditions created by means of CreateStandardView family of methods. /// Set of exceptions (negative conditions) created by means of CreateStandardView family of methods. /// Resource representing the registered view. /// Overload method which additionally specifies a set of resource types for which /// the view is valid IResource RegisterView( string name, IResource[] conditions, IResource[] exceptions ); /// /// Register a view with the given set of conditions and exceptions. It creates new view each call. /// /// Name of a view. /// A set of resource type names for which view is applicable (null if the view can be applied to all resource types). /// Set of conditions created by means of CreateStandardView family of methods. /// Set of exceptions (negative conditions) created by means of CreateStandardView family of methods. /// Resource representing the registered view. /// Overload method which does not specify a set of resource types for which /// the view is valid IResource RegisterView( string name, string[] resTypes, IResource[] conditions, IResource[] exceptions ); IResource RegisterView( string name, string[] resTypes, IResource[][] conditionGroups, IResource[] exceptions ); /// /// Register a view with the given set of conditions and exceptions. Method modifies the existing /// view resource with the given parameters. /// /// A basic resource which is modified. /// Name of a view. /// A set of resource type names for which view is applicable (null if the view can be applied to all resource types). /// Set of conditions created by means of CreateStandardView family of methods. /// Set of exceptions (negative conditions) created by means of CreateStandardView family of methods. /// Overload method which does not modify existing view resource if it exist. void ReregisterView ( IResource view, string name, string[] resTypes, IResource[] conditions, IResource[] exceptions ); void ReregisterView ( IResource view, string name, string[] resTypes, IResource[][] conditionGroup, IResource[] exceptions ); /// /// Delete a view. /// /// Name of a view. void DeleteView( string viewName ); /// /// Delete a view. /// /// Resource representing a view. void DeleteView( IResource view ); IResource CloneView( IResource from, string newName ); /// /// Makes possible a view to be visible in all tabs including those /// containing "exclusive" resource types. /// /// Resource representing a view. /// 403 void SetVisibleInAllTabs( IResource view ); /// /// Returns true if a view is visible in all tabs including those /// containing "exclusive" resource types. /// /// Resource representing a view. /// 403 bool IsVisibleInAllTabs( IResource view ); #endregion Views #region Rule Actions /// /// Methods registers a rule action - an object of a class which implements /// IRuleAction interface. /// /// Name of an action. This string is visible when user selects an action /// when constructing a rule. /// Deep name of an action - a name which is permanent independently of /// potential action renamings and translations. All action are identified using deep names, /// not display ones. /// An object implementing the particular action. /// Resource representing the registered action. /// Overload method which additionally specifies a set of resource types for which /// the action is valid IResource RegisterRuleAction( string actionName, string deepName, IRuleAction executor ); /// /// Methods registers a rule action - an object of a class which implements /// IRuleAction interface. /// /// Name of an action. This string is visible when user selects an action /// when constructing a rule. /// Deep name of an action - a name which is permanent independently of /// potential action renamings and translations. All action are identified using deep names, /// not display ones. /// An object implementing the particular action. /// A set of resource type names for which the action is valid. /// Resource representing the registered action. /// Overload method which does not specify a set of resource types for which /// the action is valid IResource RegisterRuleAction( string actionName, string deepName, IRuleAction executor, string[] types ); /// /// Methods registers a rule action template - an object of a class which /// implements IRuleAction interface and template parameters by means of which /// selected values can be passed to the object in runtime. /// /// Name of an action template. This string is visible when /// user selects an action when constructing a rule. /// Deep name of an action template - a name which is permanent /// independently of potential action template renamings and translations. All /// action template are identified using deep names, not display ones. /// An object implementing the particular action. /// Action parameters operation. /// Operation arguments. /// Resource representing the registered action template. /// Overload method which does not specify a set of resource types for which /// the action is valid IResource RegisterRuleActionTemplate( string name, string deepName, IRuleAction executor, ConditionOp op, params string[] values ); /// /// Methods registers a rule action template - an object of a class which /// implements IRuleAction interface and template parameters by means of which /// selected values can be passed to the object in runtime. /// /// Name of an action template. This string is visible when /// user selects an action when constructing a rule. /// Deep name of an action template - a name which is permanent /// independently of potential action template renamings and translations. All /// action template are identified using deep names, not display ones. /// An object implementing the particular action. /// A set of resource type names for which the action is valid. /// Action parameters operation. /// Operation arguments. /// Resource representing the registered action template. /// Overload method which does not specify a set of resource types for which /// the action is valid IResource RegisterRuleActionTemplate( string name, string deepName, IRuleAction executor, string[] types, ConditionOp op, params string[] values ); IResource RegisterRuleActionTemplateWithUIHandler( string name, string deepName, IRuleAction executor, string[] types, ITemplateParamUIHandler handler, ConditionOp op, params string[] values ); /// /// Sets a single selection mode of parameter values for condition/action template. /// /// Resource representing a template. void MarkActionTemplateAsSingleSelection( IResource actionTemplate ); /// /// Check whether an rule action is instantiated, that is IRuleAction object /// is created and registered for this action. /// /// Resource representing a rule action. /// True if IRuleAction object is registered for this rule action. bool IsActionInstantiated( IResource action ); /// /// Create a proxy rule action from an action template by instantiating of /// template with necessary typed parameter. Link action and template for /// subsequent modifications. /// /// A resource representing a filter template. /// Parameter for instantiation. /// For action templates with UI handlers this string /// contains external representation of the parameter value. Pass null if not necessary. /// A resource representing an proxy rule action. /// 556 IResource InstantiateRuleActionTemplate( IResource template, object param, string representation ); #endregion Rule Actions #region Rules /// /// Register rule. If a rule with the given name already exists, it is deleted and /// new rule resource is created. /// /// The name of an event when the rule is activated. /// Name of a rule. /// A set of resource type names for which the rule is valid. /// An array of rule conditions. /// An array of rule exceptions (negative conditions). /// An array of actions. /// Resource representing the registered rule. /// 556 IResource RegisterRule( string eventName, string ruleName, string[] resTypes, IResource[] conditions, IResource[] exceptions, IResource[] actions ); /// 993 IResource RegisterRule( string eventName, string ruleName, string[] resTypes, IResource[][] conditionGroups, IResource[] exceptions, IResource[] actions ); /// /// Reregister rule - overwrite the data for the existing rule resource. /// /// The name of an event when the rule is activated. /// A resource which parameters will be overwritten. /// Name of a rule. /// A set of resource type names for which the rule is valid. /// An array of rule conditions. /// An array of rule exceptions (negative conditions). /// An array of actions. /// 556 void ReregisterRule( string eventName, IResource existingRule, string ruleName, string[] resTypes, IResource[] conditions, IResource[] exceptions, IResource[] actions ); /// 993 void ReregisterRule( string eventName, IResource existingRule, string ruleName, string[] resTypes, IResource[][] conditionGroups, IResource[] exceptions, IResource[] actions ); /// /// Delete a rule. /// /// Name of a rule, by which it was registered in the RegisterRule method. void DeleteRule( string viewName ); /// /// Delete a rule. /// /// A resource representing a rule (returned by RegisterRule method). void DeleteRule( IResource rule ); /// /// Rename a rule. /// /// A resource representing a rule (returned by RegisterRule method). /// New name for a resource. /// Throws ArgumentException object if the rule with the new name already exists. /// 548 void RenameRule( IResource rule, string newName ); /// /// Activate a rule if it was deactivated. /// /// Resource of a rule, returned by the RegisterRule method. void ActivateRule( IResource rule ); /// /// Deactivate a rule - exclude it from the list of rules which process incoming resource. /// /// Resource of a rule, returned by the RegisterRule method. void DeactivateRule( IResource rule ); /// /// Perform actions for marking rule as invalid so that it is not used in the normal /// application run. /// /// A rule resource. /// String message describing the reason of rule deactivation. /// 997 void MarkRuleAsInvalid( IResource rule, string reason ); /// /// Assign an order number for a rule - determine the order in which rules are processed for any given resource. /// /// Resource of a rule, returned by the RegisterRule method. /// Order of a rule in the rules list. void AssignOrderNumber( IResource rule, int num ); /// /// Find an action rule resource given its name. /// /// Name of a rule. /// A resource representing the action rule. IResource FindRule( string name ); /// /// Check whether a rule is active. /// /// A resource representing a rule. /// True if a rule is active. bool IsRuleActive( IResource rule ); #endregion Rules #region Rename /// /// Rename created condition. This method must be called right after the /// condition with new name is [re]created. /// /// Old name of a condition (under which is was created). /// New name of a condition. void RenameCondition ( string oldName, string newName ); /// /// Rename created condition template. This method must be called right after the /// condition with new name is [re]created. /// /// Old name of a condition template (under which is was created). /// New name of a condition template. void RenameConditionTemplate ( string oldName, string newName ); /// /// Rename created rule action. This method must be called right after the /// rule action with new name is [re]created. /// /// Old name of a rule action (under which is was created). /// New name of a rule action. void RenameRuleAction( string oldName, string newName ); #endregion Rename #region Getters/Setters /// /// Return a list of registered views. /// /// List of registered views. IResourceList GetViews(); /// /// Return a list of registered ormatting rules. /// /// Indicates whether visible rules are requested (that is such rules which are /// shown and editable in the Rules Manager). /// List of registered views. IResourceList GetFormattingRules( bool visible ); /// /// Return a list of linked conditions of a rule or view. /// /// Resource representing the rule or view. /// List of linked conditions. IResourceList GetConditions( IResource viewOrRule ); /// /// Return a list of linked conditions of a rule or view. It iterates over /// all conjunction groups and returns a plain list. /// /// Resource representing the rule or view. /// List of linked conditions. IResourceList GetConditionsPlain( IResource viewOrRule ); /// /// Return a list of associated exceptions of a rule or view. /// /// Resource representing the rule or view. /// List of associated exceptions. IResourceList GetExceptions( IResource viewOrRule ); /// /// Return a list of associated actions of a rule. /// /// Resource representing the rule. /// List of associated actions. IResourceList GetActions ( IResource rule ); /// /// Creates a new condition with all the parameters equal to the input one. /// /// Resource representing a condition to clone. /// Resource representing new condition. IResource CloneCondition( IResource condition ); /// /// Creates a new action with all the parameters equal to the input one. /// /// Resource representing an action to clone. /// Resource representing new action. IResource CloneAction ( IResource action ); /// /// Extract all conditions that are derived from the given template and linked to /// it with the Core.FilterRegistry.Props.TemplateLink link. /// /// Condition template resource. /// List of conditions derived from the given template. /// 2.5 IResourceList GetLinkedConditions( IResource conditionTemplate ); #endregion Getters/Setters /// /// Access standard conditions and templates. /// /// 445 IStandardConditions Std { get; } /// /// Get the standard name of a view under which search results are shown. /// string ViewNameForSearchResults { get; } /// /// IFilterManagerProps Props { get; } } public interface IFilterEngine { #region Views Execution /// /// Activates a view, that is extracts a set of resource matching the /// view conditions/exceptions and passes the result to ResourceList Browser. /// /// Resource representing a view. /// Activated view name. /// 2.1 IResourceList ExecView( IResource view, string viewName ); /// /// Extract a set of resources matching the view's conditions/exceptions. /// /// Resource representing a view. /// Result list of resources. IResourceList ExecView( IResource view ); /// /// Extract a set of resources matching the view's conditions/exceptions from /// a given initial set of resources. /// /// Resource representing a view. /// List of resources from which matched resources must be selected. /// Result list of resources. /// 544 IResourceList ExecView( IResource view, IResourceList initialSet ); /// Resource representing a view. /// List of resources from which matched resources must be selected. /// Required mode of the resulting resource list (default is Snapshot). /// 1180 IResourceList ExecView( IResource view, IResourceList initialSet, SelectionType mode ); /// /// /// Resource representing a view. /// A resource which is checked against the view's conditions and exceptions. /// Perform match only for those resources which belong to the same /// workspace as the view. /// True if a resource matches the conditions/exceptions of the view. /// 438 bool MatchView( IResource view, IResource res, bool checkWorkspace ); #endregion Views Execution #region Rules Execution /// /// Activate execution of rules associated with the given event for the /// given resource in the particular order (order can be changed by means /// of method "AssignOrderNumber"). /// /// Specifies the name of an event (resource received, resource is sent, ect) /// Resource for which rules are activated. /// True if any rule matched its condition against the resource /// and was activated bool ExecRules( string eventName, IResource res ); /// /// Activate the particular rule for the given list of resources. /// /// Resource representing a rule. /// List of resources for which a rule is activated. /// 419 void ExecRule( IResource rule, IResourceList list ); /// /// Apply rule's actions to a given resource. /// /// A resource representing a rule. /// A resource which actions must be applied to. /// 544 void ApplyActions( IResource rule, IResource res ); #endregion Rules Execution #region Events Registration /// /// Register a string identifier of a logical event in the system. Using this /// id core and plugins can mark that some event has occured and call /// execution of rules for such an event over the needed resources. /// /// Name of an event. /// String which is shown in the combobox of the Edit Rule form. /// 556 void RegisterActivationEvent( string eventName, string displayName ); /// /// Retrieves a collection of registered events and returns them in the /// hashtable of pairs (eventName, displayName); /// /// /// 556 Hashtable GetRegisteredEvents(); /// /// If a plugin registers task-specific actions and rules for some particular /// resource type, this type must be registered in the system by means of this /// method. /// /// A string representing the name of a resource type. void RegisterRuleApplicableResourceType( string resType ); #endregion Events Registration } public interface IFilterManagerProps { int OpProp { get; } int TemplateLink { get; } int Invisible { get; } int SetValueLink { get; } int LinkedConditions { get; } int LinkedExceptions { get; } int LinkedActions { get; } } /// /// Interface for classes which implement custom conditions. /// public interface ICustomCondition { /// /// Predicate which matches a resource against the condition implemented /// in the custom condition class. This method is called when a custom condition /// is used in rules. /// /// Resource for matching. /// True, if a resource matches the condition implemented by the class. bool MatchResource( IResource resource ); /// /// Produce a list of resources matching the condition and given restriction on resource types. /// This method is calles when a custom condition is used in views. /// /// Resource type(s) description. /// Result list of resources matching the custom conditon. IResourceList Filter( string resType ); } public interface ICustomConditionTemplate { /// /// Predicate which matches a resource against the condition implemented /// in the custom condition class. This method is called when a custom condition /// is used in rules. /// /// Resource for matching. /// Container for parameters specified when instantiating the condition template. /// True, if a resource matches the condition implemented by the class. bool MatchResource( IResource resource, IActionParameterStore actionStore ); /// /// Produce a list of resources matching the condition and given restriction on resource types. /// This method is calles when a custom condition is used in views. /// /// Resource type(s) description. /// Container for parameters specified when instantiating the condition template. /// Result list of resources matching the custom conditon. IResourceList Filter( string resType, IActionParameterStore actionStore ); } /// /// Interface for classes implementing rule actions. Rule actions are called /// when a resource matches against the rule's conditions. Each action is called /// in turn for the same resource. /// public interface IRuleAction { /// /// Exec an implemented action over the input resource. /// /// Resource for which action is called. /// Class which incapsulates the parameters chosen when /// action was parameterized through action template. void Exec( IResource res, IActionParameterStore actionStore ); } /// /// Interface for classes implementing wrapper around the set of parameters choosen /// when the action was parameterized through action template. /// public interface IActionParameterStore { /// /// Return set of parameters as resource list. If parameters were of /// integral types or represented of set of string, exception is raised. /// /// Set of parameters as resources list. IResourceList ParametersAsResList(); /// /// Return set of parameters as strings list. If parameters were of /// integral types or represented of set of resource, exception is raised. /// /// Set of parameters as strings list. string ParameterAsString(); } /// /// This interface is used to construct small graphical elements - forms which are shown /// when user edits parameters of condition templates. These forms are used to represent /// semantically parameters for which editing in their ordinary format is not user-friendly. /// For example, task importance is specified by int value (-1, 0, 1), but UI handler for /// displaying a group of radio buttons is much more convenient. /// public interface ITemplateParamUIHandler { /// /// Show the form, accept the result. /// /// Parent form handle. /// Result of the dialog run. DialogResult ShowUI( IWin32Window parent ); /// /// Set the resource of the condition template which parameter will be edited. /// IResource Template { set; } } /// /// UI handler interface for visually editing list of resources. /// public interface IResourceListTemplateParamUIHandler : ITemplateParamUIHandler { IResourceList Result { get; } IResourceList CurrentValue{ set; } } /// /// UI handler interface for visually editing a value represented as string. /// public interface IStringTemplateParamUIHandler : ITemplateParamUIHandler { /// /// Sets the current internal value referenced by the template. /// string CurrentValue { set; } /// /// Get the handler result in the internal form. /// string Result { get; } /// /// Get the handler's result in the form which will be shown in the View/Rule dialog. /// string DisplayString { get; } } }