Show / Hide Table of Contents

Class ReturnFieldsCalculatorBase

Base class for return fields calculators. A return field calculator is a class that takes a provider name and an array of restrictions, and determines a 'sensible' set of return fields (i.e., what you could give to SetDesiredColumns(params string[])) based on what the provider offers and what you search for. The actual calculators are plugins; if you base them on this class, a lot of the standard stuff is taken care of.

Inheritance
object
ReturnFieldsCalculatorBase
ContactSelectionReturnFieldsCalculator
FindAppointmentReturnFieldsCalculator
FindDocumentReturnFieldsCalculator
FindProjectReturnFieldsCalculator
FindSaleReturnFieldsCalculator
FindSelectionReturnFieldsCalculator
FindContactReturnFieldsCalculator
FreetextAppointmentReturnFieldsCalculator
FreetextContactReturnFieldsCalculator
FreetextDocumentReturnFieldsCalculator
FreetextPersontReturnFieldsCalculator
FreetextProjectReturnFieldsCalculator
FreetextSaleReturnFieldsCalculator
FreetextSelectionReturnFieldsCalculator
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public abstract class ReturnFieldsCalculatorBase
Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

Constructors

ReturnFieldsCalculatorBase()

Base class for return fields calculators. A return field calculator is a class that takes a provider name and an array of restrictions, and determines a 'sensible' set of return fields (i.e., what you could give to SetDesiredColumns(params string[])) based on what the provider offers and what you search for. The actual calculators are plugins; if you base them on this class, a lot of the standard stuff is taken care of.

Declaration
protected ReturnFieldsCalculatorBase()
Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

Properties

SearchFields

Use this property to be able to iterate over search fields. Use the HasSearchField method to efficiently determine if a certain search field is present

Declaration
protected Dictionary<int, ArchiveRestrictionInfo> SearchFields { get; }
Property Value
Type Description
Dictionary<int, ArchiveRestrictionInfo>
Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

Methods

AddBlockedFields(params string[])

Add a field to the block list, which is checked by AddReturnFields(params string[]). Also removes any existing return fields that match the block fields (so blocking is also retroactive).

Declaration
protected void AddBlockedFields(params string[] fields)
Parameters
Type Name Description
string[] fields
Remarks

If another plugin for the same provider adds a field, that addition will NOT be blocked, regardless of whether it is before or after this one. Duplicates in calls to this method are OK and will be quietly ignored

AddReturnFields(params string[])

Add a field name to the result field list, unless it is blocked. Duplicates are OK and will be quietly ignored

Declaration
protected void AddReturnFields(params string[] fields)
Parameters
Type Name Description
string[] fields

Fields to add to the result list

Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

CalculateReturnFields(ArchiveRestrictionInfo[])

Calculate return fields by calling the InnerCalculateReturnFields() method, and adding all active search fields that have not been blocked (in this order)

Declaration
public string[] CalculateReturnFields(ArchiveRestrictionInfo[] searchFields)
Parameters
Type Name Description
ArchiveRestrictionInfo[] searchFields

Search fields

Returns
Type Description
string[]

Return fields, ready to be used in SetDesiredColumns

Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

HasSearchFields(params string[])

Check if one or more of the given fields exist in the search fields. The result is true if at least one exists. The field name comparison is case insensitive.

Declaration
protected bool HasSearchFields(params string[] fields)
Parameters
Type Name Description
string[] fields

One or more fields to check against the search fields

Returns
Type Description
bool

True if at least one field matches the search fields

Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

InnerCalculateReturnFields()

Subclass contract - you implement this method to add your return fields.

Declaration
protected abstract void InnerCalculateReturnFields()
Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(params string[]) to determine if the caller passed along a certain restriction; AddReturnFields(params string[]) to add return fields, and AddBlockedFields(params string[]) to specify that a certain field should NOT be in the return fields.

The base class will by itself add the active search fields to the end of the result fields list, unless they are blocked.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top