Class UtilityExtensions
Defines a set of utility extension methods.
Inheritance
Inherited Members
Namespace: Quark.CMSAdapters.QPP
Assembly: Quark.CMSAdapters.QPP.dll
Syntax
public static class UtilityExtensions
Methods
ConvertToCollectionPath(List<String>)
Converts to collection path.
Declaration
public static string ConvertToCollectionPath(this List<string> folderPath)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | folderPath | The folder path. |
Returns
Type | Description |
---|---|
System.String |
ConvertToDefaultRenditionType(RenditionTypes)
Converts the RenditionTypes to DefaultRenditionTypes.
Declaration
public static int ConvertToDefaultRenditionType(this RenditionTypes renditionType)
Parameters
Type | Name | Description |
---|---|---|
RenditionTypes | renditionType | Type of the rendition. |
Returns
Type | Description |
---|---|
System.Int32 |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Unsupported - renditionType |
ConvertToFolderPath(String)
Converts to folder path.
Declaration
public static List<string> ConvertToFolderPath(this string collectionPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | collectionPath | The collection path. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
FormattedName(DomainValue)
Formats domain value name as per the preferred format e.g. in case of users first name and last name is appended with the domain value name. In case no format is set domain value name is returned.
Declaration
public static string FormattedName(this DomainValue domainValue)
Parameters
Type | Name | Description |
---|---|---|
DomainValue | domainValue | The domain value. |
Returns
Type | Description |
---|---|
System.String |
GetConnectionDetails(PreferenceService)
Gets the connection details.
Declaration
public static string GetConnectionDetails(this PreferenceService preferenceService)
Parameters
Type | Name | Description |
---|---|---|
PreferenceService | preferenceService |
Returns
Type | Description |
---|---|
System.String |
GetConnectionSettings(PreferenceService)
Gets the connection settings.
Declaration
public static ConnectionSettings GetConnectionSettings(this PreferenceService preferenceService)
Parameters
Type | Name | Description |
---|---|---|
PreferenceService | preferenceService | The preference service. |
Returns
Type | Description |
---|---|
ConnectionSettings |
GetConnectionsInfo(PreferenceService)
Gets the connection setting profiles.
Declaration
public static ConnectionInfoList GetConnectionsInfo(this PreferenceService preferenceService)
Parameters
Type | Name | Description |
---|---|---|
PreferenceService | preferenceService | The preference service. |
Returns
Type | Description |
---|---|
ConnectionInfoList |
GetDefaultPreferences()
Gets the default preferences JSON object.
Declaration
public static object GetDefaultPreferences()
Returns
Type | Description |
---|---|
System.Object |
GetDisplayValue(AttributeValue)
Gets the display value of the specified attribute value.
Declaration
public static string GetDisplayValue(this AttributeValue attributeValue)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attributeValue | The attribute value. |
Returns
Type | Description |
---|---|
System.String |
GetImageResource(String)
Gets the image.
Declaration
public static ImageSource GetImageResource(this string imageName)
Parameters
Type | Name | Description |
---|---|---|
System.String | imageName | Name of the image. |
Returns
Type | Description |
---|---|
System.Windows.Media.ImageSource |
GetJsonValue<T>(Object, String, Boolean)
Gets the json value.
Declaration
public static T GetJsonValue<T>(this object serializedJsonObject, string key, bool throwError = false)
Parameters
Type | Name | Description |
---|---|---|
System.Object | serializedJsonObject | The serialized json object. |
System.String | key | The key. |
System.Boolean | throwError | if set to |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetPath(DomainValue)
Gets the path.
Declaration
public static string GetPath(this DomainValue domainValue)
Parameters
Type | Name | Description |
---|---|---|
DomainValue | domainValue | The domain value. |
Returns
Type | Description |
---|---|
System.String |
HandlePrivilegeException(Exception)
Handle prvilege exceptions specifically.
Declaration
public static void HandlePrivilegeException(this Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | The exception. |
IsNullOrZero(AssetVersion)
Determines whether the specified asset version is null or major and minor values are zero.
Declaration
public static bool IsNullOrZero(this AssetVersion assetVersion)
Parameters
Type | Name | Description |
---|---|---|
AssetVersion | assetVersion | The asset version. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RunInLoop(Func<Boolean>)
Invokes the specified delegate in loop until it returns false. In every iteration, it increments the sleep interval by 200ms with max limit set to 2 seconds.
Declaration
public static void RunInLoop(this Func<bool> function)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Boolean> | function | Delegate with bool return value |
ToAssetInfo(Object, Nullable<Boolean>)
Converts to AssetInfo.
Declaration
public static AssetInfo ToAssetInfo(this object jsonSerializedObject, bool? keepVersionInfo = default(bool? ))
Parameters
Type | Name | Description |
---|---|---|
System.Object | jsonSerializedObject | The json serialized object. |
System.Nullable<System.Boolean> | keepVersionInfo | if set to |
Returns
Type | Description |
---|---|
AssetInfo |
ToBoolValue(AttributeValue)
Applicable to attribute type BOOLEAN.
Declaration
public static bool ToBoolValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute | The attribute. |
Returns
Type | Description |
---|---|
System.Boolean |
ToBoolValue(Boolean, Int64)
Converts to boolean value attribute.
Declaration
public static AttributeValue ToBoolValue(this bool value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | if set to |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToDateTimeValue(String, Int64)
Converts to datetime value attribute.
Declaration
public static AttributeValue ToDateTimeValue(this string value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToDateValue(String, Int64)
Converts to date value attribute.
Declaration
public static AttributeValue ToDateValue(this string value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToDisplayString(Exception)
Converts to display string.
Declaration
public static string ToDisplayString(this Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | The exception. |
Returns
Type | Description |
---|---|
System.String |
ToDomainListValue(AttributeValue)
Applicable to attribute type DOMAIN.
Declaration
public static List<DomainValue> ToDomainListValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<DomainValue> |
ToDomainValue(AttributeValue)
Applicable to attribute type DOMAIN.
Declaration
public static DomainValue ToDomainValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute |
Returns
Type | Description |
---|---|
DomainValue |
ToDomainValue(DomainValue, Int64)
Converts to domain value attribute.
Declaration
public static AttributeValue ToDomainValue(this DomainValue value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
DomainValue | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToDomainValue(List<DomainValue>, Int64)
Converts to domain value attribute.
Declaration
public static AttributeValue ToDomainValue(this List<DomainValue> values, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<DomainValue> | values | The values. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToDoubleValue(AttributeValue)
Applicable to attribute type MEASUREMENT.
Declaration
public static double ToDoubleValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute |
Returns
Type | Description |
---|---|
System.Double |
ToFormAttributeValue(AttributeValue)
Converts to attribute value JSON object for asset save form.
Declaration
public static object ToFormAttributeValue(this AttributeValue attributeValue)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attributeValue | The attribute value. |
Returns
Type | Description |
---|---|
System.Object |
ToLongValue(AttributeValue)
Applicable to attribute type NUMERIC.
Declaration
public static long ToLongValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute | The attribute. |
Returns
Type | Description |
---|---|
System.Int64 |
ToMeasurementValue(Double, Int64)
Converts to measurement value attribute.
Declaration
public static AttributeValue ToMeasurementValue(this double value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToNumericValue(Int64, Int64)
Converts to numeric value attribute
Declaration
public static AttributeValue ToNumericValue(this long value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToStringValue(AttributeValue)
Applicable to attribute type TEXT,DATE,DATETIME and TIME.
Declaration
public static string ToStringValue(this AttributeValue attribute)
Parameters
Type | Name | Description |
---|---|---|
AttributeValue | attribute | The attribute. |
Returns
Type | Description |
---|---|
System.String |
ToTextValue(String, Int64)
Converts to text value attribute.
Declaration
public static AttributeValue ToTextValue(this string value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ToTimeValue(String, Int64)
Converts to time value attribute.
Declaration
public static AttributeValue ToTimeValue(this string value, long attributeId)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
System.Int64 | attributeId | The attribute identifier. |
Returns
Type | Description |
---|---|
AttributeValue |
ValidateFileAttributes(QPPSaveOptions, String, Boolean)
Validates the file name and path specific attributes.
Declaration
public static void ValidateFileAttributes(this QPPSaveOptions saveOptions, string filePath, bool validateAssetName = true)
Parameters
Type | Name | Description |
---|---|---|
QPPSaveOptions | saveOptions | The save options. |
System.String | filePath | The file path. |
System.Boolean | validateAssetName | if set to |