Table of Contents

Interface IMutableRecordModel

Namespace
PushTechnology.ClientInterface.Data.Record.Model
Assembly
Diffusion.Client.dll

The mutable data model of IRecordV2 data based upon a ISchema.

public interface IMutableRecordModel : IRecordModel
Inherited Members

Remarks

An initial version of such a model can be created from a schema using the CreateMutableModel() method. A model created in this way will have all mandatory fields set to default values.

The model may then be updated as required and then at any time a IRecordV2 object can be generated from the current state using the AsValue() method. The IRecordV2 object may then be used to update a topic.

When values for integer or decimal type fields are supplied the values are validated and normalized.

All mutator methods return the model so that calls can be chained.

Implemented in Version 6.0.

Methods

Add(string, int, params string[])

Adds new values to the end of a variable length field list.

IMutableRecordModel Add(string recordName, int recordIndex, params string[] values)

Parameters

recordName string

The name of the record.

recordIndex int

The index identifying the occurrence of the record.

values string[]

The values to add.

Returns

IMutableRecordModel

The current model instance.

Remarks

This can only be used for a variable multiplicity field which can only be the last field in a record and therefore the field does not need to be named.

Add(params string[])

Adds new values to the end of a variable length field list.

IMutableRecordModel Add(params string[] values)

Parameters

values string[]

The values.

Returns

IMutableRecordModel

The current model instance.

Remarks

This is a convenience method for adding to the end of the last record and is therefore useful when there is only one record type.

AddRecord()

Adds a new initialized record occurrence to the end of a variable multiplicity record list.

IMutableRecordModel AddRecord()

Returns

IMutableRecordModel

The current model instance.

Remarks

As the only variable multiplicity record can be the last one there is no need to name the record. This method will add to the list of occurrences of the last defined record. The record will be initialized with default values appropriate to the schema definition and may then have individual field items set separately.

ClearVariableFields(string, int)

Remove all optional instances of a variable multiplicity field.

IMutableRecordModel ClearVariableFields(string recordName, int recordIndex)

Parameters

recordName string

The name of the record.

recordIndex int

The index of the record.

Returns

IMutableRecordModel

The current model instance.

Remarks

As a variable repeating field can only be the last or only field within a record then the field name does not need to be specified.

This will only remove field occurrences down to the minimum number of occurrences specified by the schema.

If the last or only field within the record is not defined as variable multiplicity, this would have no effect.

ClearVariableRecords()

Removes all optional instances of a variable multiplicity record.

IMutableRecordModel ClearVariableRecords()

Returns

IMutableRecordModel

The current model instance.

Remarks

As a variable repeating record can only be the last or only record then the record name does not need to be specified.

This will only remove record occurrences down to the minimum number of occurrences specified by the schema.

If the last or only record is not defined as variable multiplicity, this would have no effect.

RemoveField(string, int, int)

Removes the specified occurrence of a variable multiplicity field.

IMutableRecordModel RemoveField(string recordName, int recordIndex, int fieldIndex)

Parameters

recordName string

The name of the record.

recordIndex int

The record index.

fieldIndex int

The index of the field to remove.

Returns

IMutableRecordModel

The current model instance.

Remarks

A variable multiplicity field must be the last or only field within a record and therefore the field name is not required.

RemoveRecord(int)

Removes the specified occurrence of a variable multiplicity record.

IMutableRecordModel RemoveRecord(int index)

Parameters

index int

The index of the record to remove.

Returns

IMutableRecordModel

The current model instance.

Remarks

A variable multiplicity record must be the last or only record within a schema and therefore the record name is not required.

Set(string, int, string, int, string)

Sets a specified field value.

IMutableRecordModel Set(string recordName, int recordIndex, string fieldName, int fieldIndex, string value)

Parameters

recordName string

The name of the record containing the field.

recordIndex int

The index of the record containing the field.

fieldName string

The name of the field.

fieldIndex int

The index of the field.

value string

The new value.

Returns

IMutableRecordModel

The current model instance.

Set(string, string)

Sets a specified field value.

IMutableRecordModel Set(string key, string value)

Parameters

key string

The field key.

value string

The field value.

Returns

IMutableRecordModel

The current model instance.

Remarks

This allows an item to be addressed using a key of the form "RecordName(RecordIndex).FieldName(FieldIndex)". Indexes may be omitted in which case 0 is assumed. The record part may also be omitted in which case the first occurrence of the first record is assumed.