IMetabasePolicy.IsObjectsIdFormatValid

Syntax

IsObjectsIdFormatValid(ObjectIdFormat: String): Boolean;

IsObjectsIdFormatValid(System.String): System.Boolean;

Parameters

ObjectIdFormat. String to check that data is correct.

Description

The IsObjectsIdFormatValid method checks the string on detecting incorrect data (the Russian language, the first character is number, and so on).

Comments

The method returns True if the string is correct and False if the string has incorrect data. If it is correct, the string can be used as identifier format. Incorrect format is not sent to a core and is not used to form objects identifiers.

To set format of repository object identifiers, use the IMetabasePolicy.ObjectsIdFormat property.

Example

To execute the example, add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Policy: IMetabasePolicy;
    Str: String;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    Policy := MS.Policy;
    
// Set string for check
    Str := "ID_*";
    
// Display check result to the console
    If Policy.IsObjectsIdFormatValid(Str) Then
        Debug.WriteLine(
"String is correct");
        
// If string is correct, set it as object identifier format
        Policy.ObjectsIdFormat := Str;
        
// Save changes
        MS.Apply;
    
Else
    Debug.WriteLine(
"String contains incorrect data");
    
End If;
    
// Check in license
    Lic := Null;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Policy: IMetabasePolicy;
    Str: String;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    Policy := MS.Policy;
    
// Set string for check
    Str := "ID_*";
    
// Display check result to the console
    If Policy.IsObjectsIdFormatValid(Str) Then
        System.Diagnostics.Debug.WriteLine(
"String is correct");
        
// If string is correct, set it as object identifier format
        Policy.ObjectsIdFormat := Str;
        // Save changes
        MS.Apply();
    
Else
    System.Diagnostics.Debug.WriteLine(
"String contains incorrect data");
    
End If;
    
// Check in license
    Lic := Null;
End Sub;

After executing the example, the console displays check result of the specified string. If string is correct, it will be set as object identifier format.

See also:

IMetabasePolicy