コード例 #1
0
        private void ReadMetadataField(ref SequenceReader <byte> subReader, MetadataFieldType fieldType, TableMetadata metadata, int numericColumnCount)
        {
            switch (fieldType)
            {
            case MetadataFieldType.SIGNEDNESS:
                metadata.Signedness = subReader.ReadBitArray(numericColumnCount);
                break;

            case MetadataFieldType.DEFAULT_CHARSET:
                metadata.DefaultCharset = ReadDefaultCharset(ref subReader);
                break;

            case MetadataFieldType.COLUMN_CHARSET:
                metadata.ColumnCharsets = ReadIntegers(ref subReader);
                break;

            case MetadataFieldType.COLUMN_NAME:
                metadata.ColumnNames = ReadStringList(ref subReader);
                break;

            case MetadataFieldType.SET_STR_VALUE:
                metadata.SetStrValues = ReadTypeValues(ref subReader);
                break;

            case MetadataFieldType.ENUM_STR_VALUE:
                metadata.EnumStrValues = ReadTypeValues(ref subReader);
                break;

            case MetadataFieldType.GEOMETRY_TYPE:
                metadata.GeometryTypes = ReadIntegers(ref subReader);
                break;

            case MetadataFieldType.SIMPLE_PRIMARY_KEY:
                metadata.SimplePrimaryKeys = ReadIntegers(ref subReader);
                break;

            case MetadataFieldType.PRIMARY_KEY_WITH_PREFIX:
                metadata.PrimaryKeysWithPrefix = ReadIntegerDictionary(ref subReader);
                break;

            case MetadataFieldType.ENUM_AND_SET_DEFAULT_CHARSET:
                metadata.EnumAndSetDefaultCharset = ReadDefaultCharset(ref subReader);
                break;

            case MetadataFieldType.ENUM_AND_SET_COLUMN_CHARSET:
                metadata.EnumAndSetColumnCharsets = ReadIntegers(ref subReader);
                break;

            default:
                throw new Exception("Unsupported table metadata field type: " + fieldType);
            }
        }
コード例 #2
0
        /// <summary>
        /// <para>Asserts that a given object fits the generic structure of a metadata field.</para>
        ///
        /// <para>Asserts that a metadata field has expected structure and property values.
        /// See <a href="https://cloudinary.com/documentation/admin_api#generic_structure_of_a_metadata_field">
        /// Generic structure of a metadata field in API reference.</a></para>
        /// </summary>
        /// <param name="metadataField">The object to test.</param>
        /// <param name="type">The type of metadata field we expect.</param>
        /// <param name="label">The label of the metadata field for display purposes.</param>
        /// <param name="externalId">(Optional) A unique identification string for the metadata field.</param>
        /// <param name="mandatory">(Optional) Whether a value must be given for this field.</param>
        /// <param name="defaultValue">(Optional) The default value for the field.</param>
        private void AssertMetadataField(MetadataFieldResult metadataField, MetadataFieldType type, string label,
                                         string externalId = null, bool mandatory = false, object defaultValue = null)
        {
            Assert.AreEqual(ApiShared.GetCloudinaryParam(type), metadataField.Type);

            if (metadataField.Type == ApiShared.GetCloudinaryParam(MetadataFieldType.Enum) ||
                metadataField.Type == ApiShared.GetCloudinaryParam(MetadataFieldType.Set))
            {
                AssertMetadataFieldDataSource(metadataField.DataSource);
            }

            Assert.AreEqual(label, metadataField.Label);
            Assert.AreEqual(mandatory, metadataField.Mandatory);
            if (!string.IsNullOrEmpty(externalId))
            {
                Assert.AreEqual(externalId, metadataField.ExternalId);
            }
            if (defaultValue != null)
            {
                Assert.AreEqual(defaultValue, metadataField.DefaultValue);
            }
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DynamicRuleElement" /> class.
 /// </summary>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="type">type.</param>
 public DynamicRuleElement(Guid id = default(Guid), string name = default(string), MetadataFieldType type = default(MetadataFieldType))
 {
     this.Id   = id;
     this.Name = name;
     this.Type = type;
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomMetadata" /> class.
 /// </summary>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="type">type.</param>
 /// <param name="displayType">displayType.</param>
 /// <param name="assignBy">assignBy.</param>
 /// <param name="enableTextValidation">enableTextValidation.</param>
 /// <param name="textValidationRule">textValidationRule.</param>
 /// <param name="booleanMetadataSettings">booleanMetadataSettings.</param>
 /// <param name="termsMetadataSettings">termsMetadataSettings.</param>
 /// <param name="userMetadataSettings">userMetadataSettings.</param>
 /// <param name="userProfileMetadataSettings">userProfileMetadataSettings.</param>
 /// <param name="azureAdMetadataSettings">azureAdMetadataSettings.</param>
 /// <param name="choiceMetadataSettings">choiceMetadataSettings.</param>
 /// <param name="linkMetadataSettings">linkMetadataSettings.</param>
 /// <param name="singleLineOrMultipleLineMetadataSettings">singleLineOrMultipleLineMetadataSettings.</param>
 public CustomMetadata(Guid id = default(Guid), string name = default(string), string description = default(string), MetadataFieldType type = default(MetadataFieldType), DisplayInReportType displayType = default(DisplayInReportType), AssignBy assignBy = default(AssignBy), bool enableTextValidation = default(bool), TextValidationRuleRef textValidationRule = default(TextValidationRuleRef), BooleanMetadataSettings booleanMetadataSettings = default(BooleanMetadataSettings), TermsMetadataSettings termsMetadataSettings = default(TermsMetadataSettings), UserMetadataSettings userMetadataSettings = default(UserMetadataSettings), UserProfileMetadataSettings userProfileMetadataSettings = default(UserProfileMetadataSettings), AzureAdMetadataSettings azureAdMetadataSettings = default(AzureAdMetadataSettings), ChoiceMetadataSettings choiceMetadataSettings = default(ChoiceMetadataSettings), LinkMetadataSettings linkMetadataSettings = default(LinkMetadataSettings), SingleLineOrMultipleLineMetadataSettings singleLineOrMultipleLineMetadataSettings = default(SingleLineOrMultipleLineMetadataSettings))
 {
     this.Name                        = name;
     this.Description                 = description;
     this.TextValidationRule          = textValidationRule;
     this.BooleanMetadataSettings     = booleanMetadataSettings;
     this.TermsMetadataSettings       = termsMetadataSettings;
     this.UserMetadataSettings        = userMetadataSettings;
     this.UserProfileMetadataSettings = userProfileMetadataSettings;
     this.AzureAdMetadataSettings     = azureAdMetadataSettings;
     this.ChoiceMetadataSettings      = choiceMetadataSettings;
     this.LinkMetadataSettings        = linkMetadataSettings;
     this.SingleLineOrMultipleLineMetadataSettings = singleLineOrMultipleLineMetadataSettings;
     this.Id                          = id;
     this.Name                        = name;
     this.Description                 = description;
     this.Type                        = type;
     this.DisplayType                 = displayType;
     this.AssignBy                    = assignBy;
     this.EnableTextValidation        = enableTextValidation;
     this.TextValidationRule          = textValidationRule;
     this.BooleanMetadataSettings     = booleanMetadataSettings;
     this.TermsMetadataSettings       = termsMetadataSettings;
     this.UserMetadataSettings        = userMetadataSettings;
     this.UserProfileMetadataSettings = userProfileMetadataSettings;
     this.AzureAdMetadataSettings     = azureAdMetadataSettings;
     this.ChoiceMetadataSettings      = choiceMetadataSettings;
     this.LinkMetadataSettings        = linkMetadataSettings;
     this.SingleLineOrMultipleLineMetadataSettings = singleLineOrMultipleLineMetadataSettings;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataList" /> class.
 /// </summary>
 /// <param name="createdBy">createdBy.</param>
 /// <param name="createdByDisplayName">createdByDisplayName.</param>
 /// <param name="id">id.</param>
 /// <param name="name">name.</param>
 /// <param name="description">description.</param>
 /// <param name="fieldType">fieldType.</param>
 /// <param name="metadataValue">metadataValue.</param>
 /// <param name="showInReportType">showInReportType.</param>
 /// <param name="lastModifiedTime">lastModifiedTime.</param>
 public MetadataList(string createdBy = default(string), string createdByDisplayName = default(string), Guid id = default(Guid), string name = default(string), string description = default(string), MetadataFieldType fieldType = default(MetadataFieldType), string metadataValue = default(string), MetadataDisplayType showInReportType = default(MetadataDisplayType), DateTime lastModifiedTime = default(DateTime))
 {
     this.CreatedBy            = createdBy;
     this.CreatedByDisplayName = createdByDisplayName;
     this.Id               = id;
     this.Name             = name;
     this.Description      = description;
     this.FieldType        = fieldType;
     this.MetadataValue    = metadataValue;
     this.ShowInReportType = showInReportType;
     this.LastModifiedTime = lastModifiedTime;
 }