Export Tool API (to Export)
ExportTool is a MEGA object enabling management of standard export of an object or collection of objects in VBScript or JAVA. This functionality is available with the "HOPEX Power Supervisor" module.
Implementation to VbScript
MegaObject can be installed using the following methods:
Syntax:
Function OpenExportTool () As MegaObject
This method returns an instance of the "ExportTool" MegaObject.
Attributes
• Propagate: Allows you to specify if object roots must be propagated.
- TRUE: To propagate; this is the default value.
- FALSE: To take object roots only.
• TransferedObject: Takes account of transfered objects.
- TRUE: The transfered objects are part of object roots; this is the default value.
- FALSE: No transfered objects taken.
• Format: Choice of format of an exchange of data.
- MGR: Ansi text data exchange; this is the default value.
- XML: XML data exchange.
• Perimeter: Perimeter is used in Export Processing to extract sets of objects and links to generate the export file. The default perimeter is defined on MetaTool “Standard of Export”.
• ContinueOnConfidential: Enables specification of whether export processing should be aborted if a confidential object is present in the collection of objects to be exported.
- TRUE: Export processing is not aborted; this is the default value.
- FALSE: Export processing is aborted.
• FoundConfidential: This attribute is specified by Export processing to indicate presence of a confidential object in object collection. You cannot modify this attribute.
Methods
Export Function
Export an object or a collection of object in data exchange file.
Syntax:
Sub Export (
oObject As MegaObject,
szFilename As String
)
Parameters:
oObject [In]
MegaObject
This object is root of Export processing.
szFileName [In]
String
This is the name of the result file. It is the full name: local or network, directories, short name of the file and Extension.
Syntax:
Sub Export (
oObjectColl As MegaCollection,
szFilename As String
)
Parameters:
oObjectColl [In]
MegaCollection
This collection of objects is root of Export processing.
szFileName [In]
String
This is the name of the result file. It is the full name: local or network, directories, short name of the file and Extension.
Remarks
The option “Authorize Data Export' must be activated to use the ExportTool component.
Sample
Option Explicit
' -----------------------------------
' -- ExportTool V1.0
' -----------------------------------
' Samples of ExportTool object installation
' Creation of 'Component ExportTool' :
Dim oExportTool
Set oExportTool = OpenExportTool
' Display parameters :
Print "Default Parameters :"
Print "- Perimeter = " & oExportTool.perimeter
Print "- Format = " & oExportTool.Format
Print "- Propagate = " & oExportTool.Propagate
Print "- TransferedObject = " & oExportTool.TransferedObject
Print "- ContinueOnConfidential = " & oExportTool.ContinueOnConfidential
' -----------------------------------
' -- Sample 1 :
' -----------------------------------
' Export a package with no transfered object
' By Default : Propagation is Active and Format is 'MGR'
' -- Constants :
Dim strObjectFileName
strObjectFileName = "C:\TEMP\ObjectExport.MGR"
oExportTool.TransferedObject = FALSE
' --
Dim oPackage
Set oPackage = GetRoot.GetCollection("~h8rEkjZmo400[Paquetage]").Item(1)
If (oPackage.GetID <> 0) Then
oExportTool.Export oPackage, strObjectFileName
' Dispaly result file in NotePad :
Dim oObjWShell
Set oObjWShell = CreateObject("WScript.Shell")
oObjWShell.Exec """C:\WINDOWS\system32\notepad.exe"" " & strObjectFileName
End If
Set oPackage = Nothing
oExportTool.TransferedObject = TRUE
' -----------------------------------
' -- Sample 2 :
' -----------------------------------
' Export all packages with No Propagation
' and the 'XML' Format
' -- Constants :
Dim strCollectionFileName
strCollectionFileName = "C:\TEMP\CollectionExport.XML"
oExportTool.Propagate = FALSE
oExportTool.Format = "XML"
' --
Dim oPackageColl
Set oPackageColl = GetRoot.GetCollection("~h8rEkjZmo400[Paquetage]")
oExportTool.Export oPackageColl, strCollectionFileName
' Dispaly result file in Internet Explorer :
Dim oCollWShell
Set oCollWShell = CreateObject("WScript.Shell")
oCollWShell.Exec """c:\program files\internet explorer\iexplore.exe"" " & strCollectionFileName
Set oPackageColl = Nothing
' Display "FoundConfidential" is need :
If (oExportTool.FoundConfidential) Then
Print "--> Confidential object is found."
End If
Set oExportTool = Nothing
The following text shows the output from the preceding code example:
Default Parameters :
- Perimeter = ~Bav0cNnAjyQR[Standard for export]
- Format = MGR
- Propagate = True
- TransferedObject = True
- ContinueOnConfidential = False
Implementation to JAVA
Constructor Detail
MegaExportTool
public MegaExportTool(MegaRoot mgRoot)
This method enables instancing of the ExportTool object.
Method Detail
propagate
public boolean propagate()
Allows you to specify if object roots must be propagated.
Returns:
- TRUE: To propagate; this is the default value.
- FALSE: To take object roots only.
propagate
public void propagate(boolean bNewPropagate)
Allows you to specify if object roots must be propagated.
Parameters:
bNewPropagate -
- TRUE: To propagate ; this is the default value.
- FALSE: To take object roots only.
transferedObject
public boolean transferedObject()
TransferedObject takes account of transfered objects.
Returns:
- TRUE: The transfered objects are part of object roots; this is the default value.
- FALSE: No transfered objects taken.
transferedObject
public void transferedObject(boolean bNewTransferedObject)
TransferedObject takes account of transfered objects.
Parameters:
bNewTransferedObject -
- TRUE: The transfered objects are part of object roots; this is the default value.
- FALSE: No transfered objects taken.
format
public java.lang.String format()
Format Choice of the format of an exchange of data.
Returns:
- MGR: ANSI text data exchange; this is the default value.
- XML: XML data exchange.
format
public void format(java.lang.String NewFormat)
Format Choice of the format of an exchange of data.
Parameters:
NewFormat -
- MGR: ANSI text data exchange; this is the default value.
- XML: XML data exchange.
perimeter
public void perimeter(java.lang.Object oPerimeterID)
Perimeter is used in Export Processing to extract sets of objects and links to generate the export file. The default perimeter is defined on MetaTool "Standard of Export".
Parameters:
oPerimeterID -
New perimeter is used in Export processing.
perimeter
public java.lang.Object perimeter()
Perimeter is used in Export Processing to extract sets of objects and links to generate the export file. The default perimeter is defined on MetaTool "Standard of Export".
Returns:
Perimeter is used in Export processing.
continueOnConfidential
public boolean continueOnConfidential()
Enables specification of whether export processing should be aborted if a confidential object is present in the collection of objects to be exported.
Returns:
- TRUE: Export processing is not aborted; this is the default value.
- FALSE: Export processing is aborted.
continueOnConfidential
public void continueOnConfidential(boolean bContinueOnConfidential)
Enables specification of whether export processing should be aborted if a confidential object is present in the collection of objects to be exported.
Parameters:
bContinueOnConfidential -
- TRUE: Export processing is not aborted; this is the default value.
- FALSE: Export processing is aborted.
foundConfidential
public boolean foundConfidential()
This attribute is specified by Export processing to indicate presence of a confidential object in object collection. You cannot modify this attribute.
Returns:
- TRUE: A confidential object is detected.
- FALSE: No confidential object is found.
Export
public void Export(MegaObject moObject,
java.lang.String strFileName)
Export an object in data exchange file.
Parameters:
moObject -
This object is root of Export processing.
strFileName -
This string is the name of the result file. It is the full name: local or network, directories, short name of the file and Extension.
Export
public void Export(MegaCollection mcObjects,
java.lang.String strFileName)
final String strFileName = "C:\\TEMP\\MegaExport.Log";
Export a collection of objects in data exchange file.
Parameters:
mcObjects -
This collection of objects is root of Export processing.
strFileName -
This string is the name of the result file. It is the full name: local or network, directories, short name of the file and Extension.
Sample
// -----------------------------------
// -- ExportTool V1.0
// -----------------------------------
// Samples of ExportTool object installation
// Creation of 'Component ExportTool' :
MegaExportTool oExportTool;
oExportTool = new MegaExportTool(mgRoot);
// Display parameters :
String szMes;
szMes = "Default Parameters : \r\n";
szMes = szMes + "Propagate : " + oExportTool.propagate() + "\r\n";
szMes = szMes + "Format : " + oExportTool.format() + "\r\n";
szMes = szMes + "Propagate : " + oExportTool.transferedObject() + "\r\n";
szMes = szMes + "continueOnConfidential : " + oExportTool.continueOnConfidential() + "\r\n";
Object oPerimeterID = oExportTool.perimeter();
szMes = szMes + "Perimeter : " + mgRoot.getObjectFromID(oPerimeterID).getProp("~210000000900[Nom]") + "\r\n";
// -----------------------------------
// -- Sample 1 :
// -----------------------------------
// Export a package with no transfered object
// By Default : Propagation is Active and Format is 'MGR'
// -- Constants :
String strObjectFileName = "C:\\TEMP\\ObjectExport.MGR";
oExportTool.transferedObject(false);
// ----
MegaObject oPackage = mgRoot.getCollection("~h8rEkjZmo400[Paquetage]").item(1);
if ((oPackage != null) && (oPackage.exists())) {
szMes = szMes + "Sample1 : Package(" + oPackage.getProp("~210000000900[Nom]") + ")\r\n";
oExportTool.Export(oPackage, strObjectFileName);
szMes = szMes + "--> Found Confidential Object : " + oExportTool.foundConfidential() + "\r\n";
}
// -----------------------------------
// -- Sample 2 :
// -----------------------------------
// Export all packages with no propagate
// By Default : Propagation is Active and Format is 'XML'
// -- Constants :
String strCollectionFileName = "C:\\TEMP\\CollectionExport.XML";
oExportTool.transferedObject(true);
oExportTool.propagate(false);
oExportTool.format("XML");
oExportTool.continueOnConfidential(true);
oExportTool.perimeter("~lCRBhWpi6DF0[Standard for export MEGA product (internal)]");
// ----
MegaCollection oPackageColl;
oPackageColl = mgRoot.getCollection("~h8rEkjZmo400[Paquetage]");
szMes = szMes + "Sample2 : All Packages\r\n";
szMes = szMes + "Default Parameters :\r\n";
szMes = szMes + "Propagate : " + oExportTool.propagate() + "\r\n";
szMes = szMes + "Format : " + oExportTool.format() + "\r\n";
szMes = szMes + "Propagate : " + oExportTool.transferedObject() + "\r\n";
szMes = szMes + "continueOnConfidential : " + oExportTool.continueOnConfidential() + "\r\n";
oPerimeterID = oExportTool.perimeter();
szMes = szMes + "Perimeter : " + mgRoot.getObjectFromID(oPerimeterID).getProp("~210000000900[Nom]") + "\r\n";
oExportTool.Export(oPackageColl, strCollectionFileName);
this.writeInFile(strFileName, szMes);