Items: IMobileApplicationPublishObjects;
Items: Prognoz.Platform.Interop.Mobile.IMobileApplicationPublishObjects;
The Items property returns the collection of objects in the published mobile application.
The collection contents cannot be changed.
Executing the example requires that the repository contains a mobile application with the OBJ_MA identifier. Add links to the Metabase, Mobile, Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
MaPubObjs: IMobileApplicationPublishObjects;
i, j: Integer;
MaPubObj: IMobileApplicationPublishObject;
Obj: IMetabaseObject;
s: String;
ObjScrs: IMobileApplicationPublishObjectSources;
ObjScr: IMobileApplicationPublishObject;
XmlDoc: IXmlDomDocument3;
el: IXmlDomElement;
Begin
mb := MetabaseClass.Active;
// Get mobile application (MA)
Mobile := mb.ItemById("OBJ_MA").Bind As IMobileApplication;
// Create a mobile application publisher
Publicator := Mobile.CreatePublicator;
// Get published objects
MaPubObjs := Publicator.Items;
// Display information about objects
For i := 0 To MaPubObjs.Count - 1 Do
MaPubObj := MaPubObjs.Item(i);
If (MaPubObj.Type = MobilePublishObjectType.AnalyticDashboard)
Or (MaPubObj.Type = MobilePublishObjectType.Analyzer)
Or (MaPubObj.Type = MobilePublishObjectType.Laner) Then
Obj := MaPubObj.PublishObject.Object;
s := Obj.Name + " (" + Obj.Id + ")";
Debug.WriteLine("Publication object: " + s);
Debug.Indent;
Debug.WriteLine("- available for publication: " + MaPubObj.IsValid.ToString);
Debug.WriteLine("- key: " + MaPubObj.Key.ToString);
Debug.WriteLine("- export is required: " + MaPubObj.NeedExport.ToString);
// Display information about object data sources
ObjScrs := MaPubObjs.Sources(MaPubObj.Key);
If ObjScrs <> Null Then
Debug.WriteLine("- data sources:");
Debug.Indent;
For j := 0 To ObjScrs.Count - 1 Do
ObjScr := ObjScrs.SourceItem(j);
Obj := ObjScr.PublishObject.Object;
s := Obj.Name + " (" + Obj.Id + ")";
Debug.WriteLine(s);
End For;
Debug.Unindent;
End If;
Debug.Unindent;
End If;
End For;
// Save parameters of published objects to XML file
XmlDoc := New DOMDocument60.Create;
el := XmlDoc.createElement("Root");
XmlDoc.appendChild(el);
MaPubObjs.SaveToXml(el);
XmlDoc.save("C:\PublishObjects.xml");
End Sub UserProc;
Example execution result: the console window displays information on the published objects of the mobile application and on their data sources. Object publishing parameters are loaded to the C:\PublishObjects.xml file.
Executing the example requires that the repository contains a mobile application with the OBJ_MA identifier.
Imports Prognoz.Platform.Interop.Mobile;
Imports Prognoz.Platform.Interop.MsXml2;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
MaPubObjs: IMobileApplicationPublishObjects;
i, j: Integer;
MaPubObj: IMobileApplicationPublishObject;
Obj: IMetabaseObject;
s: String;
ObjScrs: IMobileApplicationPublishObjectSources;
ObjScr: IMobileApplicationPublishObject;
XmlDoc: IXmlDomDocument3;
el: IXmlDomElement;
Begin
mb := Params.Metabase;
// Get mobile application (MA)
Mobile := mb.ItemById["OBJ_MA"].Bind() As IMobileApplication;
// Create a mobile application publicator
Publicator := Mobile.CreatePublicator();
// Get published objects
MaPubObjs := Publicator.Items;
// Output information about objects
For i := 0 To MaPubObjs.Count - 1 Do
MaPubObj := MaPubObjs.Item[i];
If (MaPubObj.Type = MobilePublishObjectType.mpotAnalyticDashboard)
Or (MaPubObj.Type = MobilePublishObjectType.mpotAnalyzer)
Or (MaPubObj.Type = MobilePublishObjectType.mpotLaner) Then
Obj := MaPubObj.PublishObject.Object;
s := Obj.Name + " (" + Obj.Id + ")";
System.Diagnostics.Debug.WriteLine("Publication object: " + s);
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("- is available for publication: " + MaPubObj.IsValid.ToString());
System.Diagnostics.Debug.WriteLine("- key: " + MaPubObj.Key.ToString());
System.Diagnostics.Debug.WriteLine("- export is required: " + MaPubObj.NeedExport.ToString());
// Output information about object data sources
ObjScrs := MaPubObjs.Sources[MaPubObj.Key];
If ObjScrs <> Null Then
System.Diagnostics.Debug.WriteLine("- data sources:");
System.Diagnostics.Debug.Indent();
For j := 0 To ObjScrs.Count - 1 Do
ObjScr := ObjScrs.SourceItem[j];
Obj := ObjScr.PublishObject.Object;
s := Obj.Name + " (" + Obj.Id + ")";
System.Diagnostics.Debug.WriteLine(s);
End For;
System.Diagnostics.Debug.Unindent();
End If;
System.Diagnostics.Debug.Unindent();
End If;
End For;
// Save parameters of published objects to XML file
XmlDoc := New DOMDocument60.Create();
el := XmlDoc.createElement("Root");
XmlDoc.appendChild(el);
MaPubObjs.SaveToXml(el);
XmlDoc.save("C:\temp\mobile\PublishObjects.xml");
End Sub;
Example execution result: the console window displays information on the published objects of the mobile application and on their data sources. Object publishing parameters are loaded to the C:\PublishObjects.xml file.
See also: