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(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.dll
Syntax
public abstract class ReturnFieldsCalculatorBase : IReturnFieldsCalculator, IPlugin
Remarks

The base class uses the Template Method pattern, and calls the InnerCalculateReturnFields() method on the derived class. That method should use HasSearchFields(String[]) to determine if the caller passed along a certain restriction; AddReturnFields(String[]) to add return fields, and AddBlockedFields(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()

Declaration
protected ReturnFieldsCalculatorBase()

Properties

SearchFields

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

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

Methods

AddBlockedFields(String[])

Add a field to the block list, which is checked by AddReturnFields(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(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

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

HasSearchFields(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
Boolean

True if at least one field matches the search fields

InnerCalculateReturnFields()

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

Declaration
protected abstract void InnerCalculateReturnFields()

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