C# Class SIL.FieldWorks.FDO.FDOTests.DataMigrationTests.MockMDCForDataMigration

Mocked version of IFwMetaDataCacheManaged for use in data migration tests.
Inheritance: IFwMetaDataCacheManaged
Datei anzeigen Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
AddCustomField ( string className, string fieldName, CellarPropertyType fieldType, int destinationClass ) : int

Add a user-defined custom field.

If 'fieldType' is a basic property type, then 'destinationClass' is ignored. If 'fieldType' is an object type (owning/reference and atomic/collection/sequence) property, then 'destinationClass' must match a class in the model.

AddCustomField ( string className, string fieldName, CellarPropertyType fieldType, int destinationClass, string fieldHelp, int fieldWs, System.Guid fieldListRoot ) : int
AddVirtualProp ( string bstrClass, string bstrField, int luFlid, int type ) : void

Note a virtual property. The type is the simulated type, one of the original types, NOT with the virtual bit OR'd in.

ClassExists ( string className ) : bool
DeleteCustomField ( int flid ) : void
FieldExists ( int flid ) : bool
FieldExists ( int classId, string fieldName, bool includeBaseClasses ) : bool
FieldExists ( string className, string fieldName, bool includeBaseClasses ) : bool
GetAbstract ( int luClid ) : bool

Indicates whether a class is abstract or concrete.

GetAllSubclasses ( int clid ) : int[]

Get all of the subclass Ids, including the given class Id.

GetAllSubclasses ( int luClid, int cluMax, int &cluOut, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgluSubclasses ) : void

Gets all subclasses of the given class, including itself (which is always the first result in the list, so it can easily be skipped if desired). The list is therefore a complete list of the classes which are valid to store in a property whose signature is the class identified by luClid.

GetBaseClsId ( int luClid ) : int

Gets the base class id for a given class.

GetBaseClsName ( int luClid ) : string

Gets the name of the base class for a given class.

GetClassId ( string bstrClassName ) : int

:>:> Reverse access methods :> Get the ID of the class having the specified name. Returns 0 if not found.

GetClassIds ( ) : int[]

Gets the list of class identification numbers (in no particular order).

GetClassIds ( int cclid, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgclid ) : void

Gets the list of class identification numbers (in no particular order). If the array provided is too small, only an arbitrary subset of cclid values is returned. If the array provided is too large, the excess entries are set to zero.

GetClassName ( int luClid ) : string

Gets the name of the class.

GetDirectSubclasses ( int clid ) : int[]

Get the class Ids of the direct subclasses of the specified class Id.

GetDirectSubclasses ( int luClid, int cluMax, int &cluOut, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgluSubclasses ) : void

Gets the direct subclasses of the given class (not including itself).

GetDstClsId ( int luFlid ) : int

Gets the "Id" of the destination class that corresponds to this field. This is the "Id" of the class that is either owned or referred to by another class.

GetDstClsName ( int luFlid ) : string

Gets the name of the destination class that corresponds to this field. This is the name of the class that is either owned or referred to by another class.

GetFieldHelp ( int luFlid ) : string

Gets the help string of a field.

GetFieldId ( string bstrClassName, string bstrFieldName, bool fIncludeBaseClasses ) : int

Gets the field ID given the class and field names. Returns 0 if not found. Searches superclasses as well as actual class given.

GetFieldId2 ( int luClid, string bstrFieldName, bool fIncludeBaseClasses ) : int

This is more efficient if the client already has the classID specified classID and field name. Returns 0 if not found. Searches superclasses as well as actual class given.

GetFieldIds ( ) : int[]

Gets the list of field identification numbers (in no particular order).

GetFieldIds ( int cflid, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgflid ) : void

Gets the list of field identification numbers (in no particular order). If the array provided is too small, only an arbitrary set of cflid values is returned. If the array provided is too large, the excess entries are set to zero.

GetFieldLabel ( int luFlid ) : string

Gets the user label of a field.

GetFieldListRoot ( int luFlid ) : System.Guid
GetFieldName ( int luFlid ) : string

Gets the name of a field.

GetFieldNameOrNull ( int luFlid ) : string

Gets the name of a field.

GetFieldType ( int luFlid ) : int

Gets the type of the field. This value indicates if the field is a primitive data type or a MultiStr/MultiTxt value or describes the relationship between two classes (i.e. owning/reference and atomic/collection/sequence). These numeric values are defined in the ~FWROOT\src\cellar\lib\CmTypes.h file.

GetFieldWs ( int luFlid ) : int

Gets the Ws of the field.

GetFieldXml ( int luFlid ) : string

Gets the Xml UI of a field.

GetFields ( int luClid, bool fIncludeSuperclasses, int grfcpt, int cflidMax, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgflid ) : int

Gets a list of the fields for the specified class. Gets all fields whose types match the specified argument, which should be a combination of the fcpt values defined in CmTypes.h, e.g., to get all owning properties pass kfcptOwningCollection | kfcptOwningAtom | kfcptOwningSequence. Returns E_FAIL if the array is too small. cflidMax 0 may be passed to obtain the required size. Fields of superclasses are also returned, if the relevant flag is true. [Note: The special CmObject fields are not returned, for now, but the plan to include them before too long.]

GetFields ( int clid, bool includeSuperclasses, int fieldTypes ) : int[]

Get the field Ids for the specified class, and optionally its superclasses.

GetIncomingFields ( int clid ) : IEnumerable
GetIncomingFields ( int clid, int fieldTypes ) : IEnumerable
GetOwnClsId ( int luFlid ) : int

Gets the "Id" value of the class that contains this field.

GetOwnClsName ( int luFlid ) : string

Gets the name of the class that contains this field.

InitXml ( string bstrPathname, bool fClearPrevCache ) : void

Alternative way to initialize, passing an XML file (like Ling.cm). <class num="int" id="className" base="baseClassName" abstract="true"> <props> <basic num="int" id="FieldName" sig="Boolean/Integer/Time/String/MultiString/MultiUnicode" /> <rel/owning num="int" id="FieldName" card="atomic/seq/col" sig="classname"/> currently doesn't initialize some less essential stuff like help strings and labels. Set fClearPrevCache to false to read in multiple XML files. Enhance JohnT: support attributes to handle these.

IsCustom ( int flid ) : bool

Check if the given flid is Custom, or not.

IsValueType ( CellarPropertyType type ) : bool

Should return true for value types; but not implemented

UpdateCustomField ( int flid, string fieldHelp, int fieldWs, string userLabel ) : void
get_IsValidClass ( int luFlid, int luClid ) : bool

Given a field id and a class id, this returns true it it is legal to store this class of object in the field.

get_IsVirtual ( int luFlid ) : bool

Private Methods

Method Description
AddClass ( int clsid, string className, string superclassName, List directSubclasses ) : void

Add some nice fake class information.

AddField ( int flid, string fieldName, CellarPropertyType cpt, int destClsid ) : void
IsSupportedFieldType ( CellarPropertyType fieldType ) : bool

Method Details

AddCustomField() public method

Add a user-defined custom field.
If 'fieldType' is a basic property type, then 'destinationClass' is ignored. If 'fieldType' is an object type (owning/reference and atomic/collection/sequence) property, then 'destinationClass' must match a class in the model.
/// Thrown if 'fieldType' is an object type (owning/reference and atomic/collection/sequence) property, /// but 'destinationClass' does not match a class in the model. /// /// Thrown if 'className' or 'fieldName' are null or empty. /// /// Thrown if class is not defined. ///
public AddCustomField ( string className, string fieldName, CellarPropertyType fieldType, int destinationClass ) : int
className string Class that gets the new custom field.
fieldName string Field name for the custom field.
fieldType CellarPropertyType Data type for the custom field.
destinationClass int Class Id for object type custom properties
return int

AddCustomField() public method

public AddCustomField ( string className, string fieldName, CellarPropertyType fieldType, int destinationClass, string fieldHelp, int fieldWs, System.Guid fieldListRoot ) : int
className string
fieldName string
fieldType CellarPropertyType
destinationClass int
fieldHelp string
fieldWs int
fieldListRoot System.Guid
return int

AddVirtualProp() public method

Note a virtual property. The type is the simulated type, one of the original types, NOT with the virtual bit OR'd in.
public AddVirtualProp ( string bstrClass, string bstrField, int luFlid, int type ) : void
bstrClass string
bstrField string
luFlid int
type int
return void

ClassExists() public method

public ClassExists ( string className ) : bool
className string
return bool

DeleteCustomField() public method

public DeleteCustomField ( int flid ) : void
flid int
return void

FieldExists() public method

public FieldExists ( int flid ) : bool
flid int
return bool

FieldExists() public method

public FieldExists ( int classId, string fieldName, bool includeBaseClasses ) : bool
classId int
fieldName string
includeBaseClasses bool
return bool

FieldExists() public method

public FieldExists ( string className, string fieldName, bool includeBaseClasses ) : bool
className string
fieldName string
includeBaseClasses bool
return bool

GetAbstract() public method

Indicates whether a class is abstract or concrete.
public GetAbstract ( int luClid ) : bool
luClid int Class identification number. In the database, this corresponds to "Id" /// column in the Class$ table.
return bool

GetAllSubclasses() public method

Get all of the subclass Ids, including the given class Id.
public GetAllSubclasses ( int clid ) : int[]
clid int Class Id to get subclass Ids of.
return int[]

GetAllSubclasses() public method

Gets all subclasses of the given class, including itself (which is always the first result in the list, so it can easily be skipped if desired). The list is therefore a complete list of the classes which are valid to store in a property whose signature is the class identified by luClid.
public GetAllSubclasses ( int luClid, int cluMax, int &cluOut, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgluSubclasses ) : void
luClid int
cluMax int
cluOut int
rgluSubclasses SIL.FieldWorks.Common.COMInterfaces.ArrayPtr
return void

GetBaseClsId() public method

Gets the base class id for a given class.
public GetBaseClsId ( int luClid ) : int
luClid int Class identification number. In the database, this corresponds to "Id" /// column in the Class$ table.
return int

GetBaseClsName() public method

Gets the name of the base class for a given class.
public GetBaseClsName ( int luClid ) : string
luClid int Class identification number. In the database, this corresponds to "Id" /// column in the Class$ table.
return string

GetClassId() public method

:>:> Reverse access methods :> Get the ID of the class having the specified name. Returns 0 if not found.
public GetClassId ( string bstrClassName ) : int
bstrClassName string
return int

GetClassIds() public method

Gets the list of class identification numbers (in no particular order).
public GetClassIds ( ) : int[]
return int[]

GetClassIds() public method

Gets the list of class identification numbers (in no particular order). If the array provided is too small, only an arbitrary subset of cclid values is returned. If the array provided is too large, the excess entries are set to zero.
public GetClassIds ( int cclid, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgclid ) : void
cclid int The size of the output array.
rgclid SIL.FieldWorks.Common.COMInterfaces.ArrayPtr An integer array for returning the class identification numbers.
return void

GetClassName() public method

Gets the name of the class.
public GetClassName ( int luClid ) : string
luClid int Class identification number. In the database, this corresponds to "Id" /// column in the Class$ table.
return string

GetDirectSubclasses() public method

Get the class Ids of the direct subclasses of the specified class Id.
public GetDirectSubclasses ( int clid ) : int[]
clid int Class Id to get the subclass Ids of.
return int[]

GetDirectSubclasses() public method

Gets the direct subclasses of the given class (not including itself).
public GetDirectSubclasses ( int luClid, int cluMax, int &cluOut, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgluSubclasses ) : void
luClid int
cluMax int
cluOut int
rgluSubclasses SIL.FieldWorks.Common.COMInterfaces.ArrayPtr
return void

GetDstClsId() public method

Gets the "Id" of the destination class that corresponds to this field. This is the "Id" of the class that is either owned or referred to by another class.
public GetDstClsId ( int luFlid ) : int
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return int

GetDstClsName() public method

Gets the name of the destination class that corresponds to this field. This is the name of the class that is either owned or referred to by another class.
public GetDstClsName ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFieldHelp() public method

Gets the help string of a field.
public GetFieldHelp ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFieldId() public method

Gets the field ID given the class and field names. Returns 0 if not found. Searches superclasses as well as actual class given.
public GetFieldId ( string bstrClassName, string bstrFieldName, bool fIncludeBaseClasses ) : int
bstrClassName string
bstrFieldName string
fIncludeBaseClasses bool
return int

GetFieldId2() public method

This is more efficient if the client already has the classID specified classID and field name. Returns 0 if not found. Searches superclasses as well as actual class given.
public GetFieldId2 ( int luClid, string bstrFieldName, bool fIncludeBaseClasses ) : int
luClid int
bstrFieldName string
fIncludeBaseClasses bool
return int

GetFieldIds() public method

Gets the list of field identification numbers (in no particular order).
public GetFieldIds ( ) : int[]
return int[]

GetFieldIds() public method

Gets the list of field identification numbers (in no particular order). If the array provided is too small, only an arbitrary set of cflid values is returned. If the array provided is too large, the excess entries are set to zero.
public GetFieldIds ( int cflid, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgflid ) : void
cflid int The size of the output array.
rgflid SIL.FieldWorks.Common.COMInterfaces.ArrayPtr An integer array for returning the field identification numbers.
return void

GetFieldLabel() public method

Gets the user label of a field.
public GetFieldLabel ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFieldListRoot() public method

public GetFieldListRoot ( int luFlid ) : System.Guid
luFlid int
return System.Guid

GetFieldName() public method

Gets the name of a field.
public GetFieldName ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFieldNameOrNull() public method

Gets the name of a field.
public GetFieldNameOrNull ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFieldType() public method

Gets the type of the field. This value indicates if the field is a primitive data type or a MultiStr/MultiTxt value or describes the relationship between two classes (i.e. owning/reference and atomic/collection/sequence). These numeric values are defined in the ~FWROOT\src\cellar\lib\CmTypes.h file.
public GetFieldType ( int luFlid ) : int
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table. /// Historical note: at one point, the result could include the virtual bit, kcptVirtual, or'd /// with one of the other kcpt values. This caused endless bugs and has been removed.
return int

GetFieldWs() public method

Gets the Ws of the field.
public GetFieldWs ( int luFlid ) : int
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return int

GetFieldXml() public method

Gets the Xml UI of a field.
public GetFieldXml ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

GetFields() public method

Gets a list of the fields for the specified class. Gets all fields whose types match the specified argument, which should be a combination of the fcpt values defined in CmTypes.h, e.g., to get all owning properties pass kfcptOwningCollection | kfcptOwningAtom | kfcptOwningSequence. Returns E_FAIL if the array is too small. cflidMax 0 may be passed to obtain the required size. Fields of superclasses are also returned, if the relevant flag is true. [Note: The special CmObject fields are not returned, for now, but the plan to include them before too long.]
public GetFields ( int luClid, bool fIncludeSuperclasses, int grfcpt, int cflidMax, SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgflid ) : int
luClid int
fIncludeSuperclasses bool
grfcpt int
cflidMax int
rgflid SIL.FieldWorks.Common.COMInterfaces.ArrayPtr
return int

GetFields() public method

Get the field Ids for the specified class, and optionally its superclasses.
public GetFields ( int clid, bool includeSuperclasses, int fieldTypes ) : int[]
clid int Class identification number.
includeSuperclasses bool 'True' to also get superclass fields.
fieldTypes int /// Gets all fields whose types match the specified argument, /// which should be a combination of the fcpt values defined in CmTypes.h, e.g., /// to get all owning properties pass kfcptOwningCollection | kfcptOwningAtom | kfcptOwningSequence. ///
return int[]

GetIncomingFields() public method

public GetIncomingFields ( int clid ) : IEnumerable
clid int
return IEnumerable

GetIncomingFields() public method

public GetIncomingFields ( int clid, int fieldTypes ) : IEnumerable
clid int
fieldTypes int
return IEnumerable

GetOwnClsId() public method

Gets the "Id" value of the class that contains this field.
public GetOwnClsId ( int luFlid ) : int
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return int

GetOwnClsName() public method

Gets the name of the class that contains this field.
public GetOwnClsName ( int luFlid ) : string
luFlid int Field identification number. In the database, this corresponds to the "Id" /// column in the Field$ table.
return string

InitXml() public method

Alternative way to initialize, passing an XML file (like Ling.cm). <class num="int" id="className" base="baseClassName" abstract="true"> <props> <basic num="int" id="FieldName" sig="Boolean/Integer/Time/String/MultiString/MultiUnicode" /> <rel/owning num="int" id="FieldName" card="atomic/seq/col" sig="classname"/> currently doesn't initialize some less essential stuff like help strings and labels. Set fClearPrevCache to false to read in multiple XML files. Enhance JohnT: support attributes to handle these.
public InitXml ( string bstrPathname, bool fClearPrevCache ) : void
bstrPathname string
fClearPrevCache bool
return void

IsCustom() public method

Check if the given flid is Custom, or not.
public IsCustom ( int flid ) : bool
flid int Field identifier to check.
return bool

IsValueType() public method

Should return true for value types; but not implemented
public IsValueType ( CellarPropertyType type ) : bool
type CellarPropertyType
return bool

UpdateCustomField() public method

public UpdateCustomField ( int flid, string fieldHelp, int fieldWs, string userLabel ) : void
flid int
fieldHelp string
fieldWs int
userLabel string
return void

get_IsValidClass() public method

Given a field id and a class id, this returns true it it is legal to store this class of object in the field.
public get_IsValidClass ( int luFlid, int luClid ) : bool
luFlid int Field identification number.
luClid int Class identification number.
return bool

get_IsVirtual() public method

public get_IsVirtual ( int luFlid ) : bool
luFlid int
return bool