Class RestrictionOperations
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Inherited Members
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.dll
Syntax
public static class RestrictionOperations
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
Fields
AllOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string AllOf = "allOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
IsNotNull
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string IsNotNull = "isNotNull"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
IsNull
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string IsNull = "isNull"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
IsPK
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string IsPK = "isPK"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
NoneOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string NoneOf = "noneOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
NotOneOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string NotOneOf = "notOneOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
OneOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string OneOf = "oneOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
OpEquals
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string OpEquals = "equals"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PhoneBegins
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string PhoneBegins = "begins"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PhoneContains
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string PhoneContains = "contains"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PhoneEquals
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string PhoneEquals = "is"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PkIsNotOneOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string PkIsNotOneOf = "pkIsNotOneOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PkIsOneOf
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string PkIsOneOf = "pkIsOneOf"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
Set
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string Set = "set"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
ValueHintDelimiter
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public const string ValueHintDelimiter = ";"
Field Value
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
Methods
BuildPeriodReturnValues(DateTime[], params int[])
Combines the two parameter-arrays into a single array, encoded as their datatype.
Declaration
public static string[] BuildPeriodReturnValues(DateTime[] calculatedValues, params int[] inputValues)
Parameters
Type | Name | Description |
---|---|---|
DateTime[] | calculatedValues | |
int[] | inputValues |
Returns
Type | Description |
---|---|
string[] |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
CalculateAndValidateNumberOfValues(ArchiveRestrictionInfo, bool)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static int CalculateAndValidateNumberOfValues(ArchiveRestrictionInfo restriction, bool throwException)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction | |
bool | throwException |
Returns
Type | Description |
---|---|
int |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
ConvertOperatorType(string)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static string ConvertOperatorType(string operatorType)
Parameters
Type | Name | Description |
---|---|---|
string | operatorType |
Returns
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
CreateListAllRestriction(ArchiveRestrictionInfo, ArchiveSelect, FieldInfo, FieldInfo, FieldInfo)
Handle restrictions for ListAll type columns, which require multiple aliased joins
Declaration
public static void CreateListAllRestriction(ArchiveRestrictionInfo restriction, ArchiveSelect targetQuery, FieldInfo leftField, FieldInfo rightField, FieldInfo valueField)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction | |
ArchiveSelect | targetQuery | |
FieldInfo | leftField | |
FieldInfo | rightField | |
FieldInfo | valueField |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
CreateSqlRestriction(ArchiveRestrictionInfo, FieldInfo)
Given a restriction information object and a target database field, create the corresponding SQL restriction, based on the field's data type, the restriction operator and any relevant values. NOTE that this method BY DESIGN does not take subrestrictions into account.
Declaration
public static Restriction CreateSqlRestriction(ArchiveRestrictionInfo restriction, FieldInfo targetField)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction | Restriction to parse |
FieldInfo | targetField | Target field in database |
Returns
Type | Description |
---|---|
Restriction |
Remarks
The implementation of this method must be able to handle all known operators. If you add an operator, you need to add its handling by declaring a method with the following signature:
public Restriction Parse[OperatorName]( ArchiveRestrictionInfo restriction, FieldInfo targetField )
Substitute the name of your operator for the [OperatorName] above. Since operator names do not have to be unique across data type, you need to check the data type of the FieldInfo and be prepared to accept any meaningful type. The method lookup is reflection-based and you do not have to anything except declare the parse method.
DatePair(ValueCalculator, FieldInfo)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static Restriction DatePair(RestrictionOperations.ValueCalculator calculator, FieldInfo targetField)
Parameters
Type | Name | Description |
---|---|---|
RestrictionOperations.ValueCalculator | calculator | |
FieldInfo | targetField |
Returns
Type | Description |
---|---|
Restriction |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
DatePair(string[], FieldInfo)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static Restriction DatePair(string[] values, FieldInfo targetField)
Parameters
Type | Name | Description |
---|---|---|
string[] | values | |
FieldInfo | targetField |
Returns
Type | Description |
---|---|
Restriction |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
GetExpandedValueHint(OperatorInfo)
Return an expanded value hint (containing default values) for the given operator.
Declaration
public static string GetExpandedValueHint(RestrictionOperations.OperatorInfo operatorInfo)
Parameters
Type | Name | Description |
---|---|---|
RestrictionOperations.OperatorInfo | operatorInfo | Operator information |
Returns
Type | Description |
---|---|
string | Expanded value hint |
Remarks
This method invokes the appropriate ValueCalculator method to calculate values, such as "next week". Some operators do not have such values defined (or meaningful), in those cases the original value hint is returned unchanged.
Exceptions
Type | Condition |
---|---|
SoIllegalOperationException | Thrown if the number of placeholders in the value hint does not correspond to the number of values returned by the value calculator; this is a fairly serious internal inconsistency since it will propagate to parsing. |
GetNumRequiredValues(ArchiveRestrictionInfo, bool)
Return the number of values required by this restriction, with or without counting calculated values. The algorithm is based on the ValueHints, and takes both the restriction type and operator into account. A negative result means 'at least this number' of values.
Declaration
public static int GetNumRequiredValues(ArchiveRestrictionInfo restriction, bool includeCalculatedInCount)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction | Restriction to parse |
bool | includeCalculatedInCount | Should calculated (read-only) values be included |
Returns
Type | Description |
---|---|
int | Number of values required; if positive then this is an absoute number, if negative, then the smallest number (more values are legal) |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
GetOperatorInfo(string, string)
Locate the OperatorInfo corresponding to the given operator name and restriction type. If the operator cannot be found for the given restriction type, try to find it using the static prefix and the restriction type.
Declaration
public static RestrictionOperations.OperatorInfo GetOperatorInfo(string operatorName, string restrictionType)
Parameters
Type | Name | Description |
---|---|---|
string | operatorName | Operator to find |
string | restrictionType | Rrestriction type, will be used alone and with static prefix |
Returns
Type | Description |
---|---|
RestrictionOperations.OperatorInfo | Operator information, or null |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
GetOperatorsForType(string)
Return an array of RestrictionOperations.OperatorInfo elements describing valid operators for the given data type. An array of length 0 is returned if the data type is unknown.
Declaration
public static RestrictionOperations.OperatorInfo[] GetOperatorsForType(string dataType)
Parameters
Type | Name | Description |
---|---|---|
string | dataType | Case-insensitive name of data type |
Returns
Type | Description |
---|---|
OperatorInfo[] | Array of operators, or empty array |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
OperatorNameToReporterOperatorName(string, string)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static string OperatorNameToReporterOperatorName(string operatorName, string operatorType)
Parameters
Type | Name | Description |
---|---|---|
string | operatorName | |
string | operatorType |
Returns
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PopulateCalculatedRestrictionValues(ArchiveRestrictionInfo)
Take an ArchiveRestrictionInfo, and populate its values. Values that are calculated are set to their current value (i.e., 'this week' is expanded to two values, denoting the start and end of the week enclosing the time when the PopulateRestrictionValues was called).
Declaration
public static void PopulateCalculatedRestrictionValues(ArchiveRestrictionInfo restriction)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction | restriction to populate |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
PopulateColumnInfo(string, string, params ArchiveRestrictionInfo[])
Populate the ColumnInfo part of an array of ArchiveRestrictionInfo, based on the given provider name. Existing ColumnInfo objects with nonempty names will be left untouched, others will be populated
Declaration
public static void PopulateColumnInfo(string providerName, string context, params ArchiveRestrictionInfo[] restrictions)
Parameters
Type | Name | Description |
---|---|---|
string | providerName | Name of archive provider to use |
string | context | |
ArchiveRestrictionInfo[] | restrictions | Restrictions to populate |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
Exceptions
Type | Condition |
---|---|
SoIllegalOperationException | Thrown if a restriction name does not match any column name of the given provider |
PopulateDisplayValues(params ArchiveRestrictionInfo[])
Take the current Values of the restrictions, and use them to set the corresponding DisplayValues. This depends on the restriction types (for instance, lists); operator (such as IsPK), or possibly other metadata or context.
Declaration
public static void PopulateDisplayValues(params ArchiveRestrictionInfo[] restrictions)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo[] | restrictions | Restrictions to inspect and update |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
ReporterOperatorNameToOperatorName(string, string)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static string ReporterOperatorNameToOperatorName(string reporterOperatorName, string restrictionType)
Parameters
Type | Name | Description |
---|---|---|
string | reporterOperatorName | |
string | restrictionType |
Returns
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
RestrictionTypeToOperatorType(string)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static string RestrictionTypeToOperatorType(string restrictionType)
Parameters
Type | Name | Description |
---|---|---|
string | restrictionType |
Returns
Type | Description |
---|---|
string |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.
SetDefaults(ArchiveRestrictionInfo)
This class provides basic restriction handling for Archive lists. It knows the allowable operators for each column type, can provide a list of them for the SoList system, and can parse a restriction (that is, the value part of the restriction). It also (re)calculates values that are relative to the current date/time or some other changeable quantity.
Declaration
public static void SetDefaults(ArchiveRestrictionInfo restriction)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo | restriction |
Remarks
The remarks on the static constructor document the naming conventions for the reflection-based method lookup, that controls much of the functionality of this class.