ImplementationURL : String;
ImplementationURL : System.String;
The ImplementationURL property sets the URL of the script implementing operations of the class object, which will be executed from Foresight Analytics Platform.
From the interface the URL of the script is specified in the Object Classes dialog box on the Operations tab.
Executing the example requires that the repository contains a resources object with the OBJ_RES identifier. There must be two icons: C:\Icon_small.ico and C:\Icon_large.ico in the file system.
Sub UserProc;
Var
Mb: IMetabase;
Object: IMetabaseObject;
CustomClassExtender: IMetabaseCustomExtender;
CustClasses: IMetabaseCustomClasses;
CustomClass: IMetabaseCustomClass;
Operations: IMetabaseCustomClassOperations;
Operation: IMetabaseCustomClassOperation;
CreateInfo: IMetabaseObjectCreateInfo;
Description: IMetabaseObjectDescriptor;
ImgList: IGxImageList;
ImgList32: IGxImageList;
Icon: IGxIcon;
CustomObject: IMetabaseCustomObject;
Begin
Mb := MetabaseClass.Active;
// Creating custom class container
CreateInfo := Mb.CreateCreateInfo;
CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUSTOM_EXTENDER;
CreateInfo.Name := "CUSTOM_EXTENDER";
CreateInfo.Permanent := True;
CreateInfo.Parent := Mb.Root;
Description := Mb.CreateObject(CreateInfo);
Object := Description.Edit;
CustomClassExtender := Object As IMetabaseCustomExtender;
ImgList := New GxImageList.Create;
ImgList.Height := 16;
Icon := New GxIcon.CreateFromFile("C:\Icon_small.ico");
ImgList.AddIcon(Icon);
CustomClassExtender.SmallImages := ImgList;
ImgList32 := New GxImageList.Create;
ImgList32.Height := 32;
Icon := New GxIcon.CreateFromFile("C:\Icon_large.ico");
ImgList32.AddIcon(Icon);
CustomClassExtender.LargeImages := ImgList32;
CustomClassExtender.IsShared := True;
CustomClassExtender.Resource := Mb.ItemById("OBJ_RES").Bind As IResourceObject;
CustomClassExtender.NameResource := "ID_CUSTOM_EXTENDER";
// Adding the custom class to the container
CustClasses := CustomClassExtender.Classes;
CustomClass := CustClasses.Add;
CustomClass.Description := Own class;
CustomClass.ImageIndex := 0;
// URL of thenbsp;scriptnbsp;implementingnbsp;operations
CustomClass.ImplementationURL := "https://site/CoolScript.js";
Operations := CustomClass.Operations;
Operation := Operations.Add(0);
Operation.Name := New method;
Object.Save;
End Sub UserProc;
After executing this example the custom classes container that contains one class is created. An identifier of the string resource ID_CUSTOM_EXTENDER from the OBJ_RES resources will be determined for a container. One operation will be defined for a class. The custom class object will be created in the repository. The C:\Icon_large.ico file is a source of a large icon, the C:\Icon_small.ico file - of a small icon. For the class the URL of the script, implementing the handler of the operation of the object class in the Web application is set - https://site/CoolScript.js.
Conditions and the result of execution are similar to the Fore Example.
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Object: IMetabaseObject;
CustomClassExtender: IMetabaseCustomExtender;
CustClasses: IMetabaseCustomClasses;
CustomClass: IMetabaseCustomClass;
Operations: IMetabaseCustomClassOperations;
Operation: IMetabaseCustomClassOperation;
CreateInfo: IMetabaseObjectCreateInfo;
Description: IMetabaseObjectDescriptor;
ImgList: GxImageList;
ImgList32: GxImageList;
Icon: GxIcon;
CustomObject: IMetabaseCustomObject;
Begin
Mb := Params.Metabase;
// Creating custom class container
CreateInfo := Mb.CreateCreateInfo();
CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUSTOM_EXTENDER As Int32;
CreateInfo.Name := "CUSTOM_EXTENDER";
CreateInfo.Permanent := True;
CreateInfo.Parent := Mb.Root;
Description := Mb.CreateObject(CreateInfo);
Object := Description.Edit();
CustomClassExtender := Object As IMetabaseCustomExtender;
ImgList := New GxImageList.Create();
ImgList.Height := 16;
Icon := New GxIconClass();
Icon.CreateFromFile("C:\Icon_small.ico");
ImgList.AddIcon(Icon);
CustomClassExtender.SmallImages := ImgList;
ImgList32 := New GxImageList.Create();
ImgList32.Height := 32;
Icon := New GxIcon.Create();
Icon.CreateFromFile("C:\Icon_large.ico");
ImgList32.AddIcon(Icon);
CustomClassExtender.LargeImages := ImgList32;
CustomClassExtender.IsShared := True;
CustomClassExtender.Resource := Mb.ItemById["OBJ_RES"].Bind() As IResourceObject;
CustomClassExtender.NameResource := "ID_CUSTOM_EXTENDER";
// Adding the custom class to the container
CustClasses := CustomClassExtender.Classes;
CustomClass := CustClasses.Add();
CustomClass.Description := Own class;
CustomClass.ImageIndex := 0;
// URL of the script implementing operations
CustomClass.ImplementationURL := "https://site/CoolScript.js";
Operations := CustomClass.Operations;
Operation := Operations.Add(0);
Operation.Name := New method;
Object.Save();
End Sub;
End Class;
See also: