DOCUMENTS 5 - PortalScripting API
Public Member Functions | List of all members
XMLExport Class Reference

The XMLExport class allows to export DOCUMENTS elements as an XML file by scripting means. More...

Public Member Functions

boolean addAccessProfile (var accessProfile)
 Add the desired access profile to the XMLExport. More...
 
boolean addAlias (String aliasName)
 Add the desired alias to the XMLExport. More...
 
boolean addCustomProperty (String propName)
 Add the desired global custom property to the XMLExport. More...
 
boolean addDistributionList (String distributionListName)
 Add the desired distribution list to the XMLExport. More...
 
boolean addDocumentsSettings ()
 Add the DOCUMENTS settings data to the XMLExport. More...
 
boolean addFellow (var editor, boolean includePrivateFolders=true)
 Add the desired editor (fellow) to the XMLExport. More...
 
boolean addFile (DocFile docFile, var exportCondition=true)
 Add the desired DocFile object to the XMLExport. More...
 
boolean addFileType (String fileTypeName)
 Add the desired file type to the XMLExport. More...
 
boolean addFileTypesFromCategory (String categoryName)
 Add all file types belonging to the specified category to the XMLExport. More...
 
boolean addFileTypesFromFolder (String folderName)
 Add all file types belonging to the specified file type folder to the XMLExport. More...
 
boolean addFilingPlan (String filingPlanName)
 Add the desired filing plan to the XMLExport. More...
 
boolean addFolder (Folder folder, boolean exportStructure, var exportCondition, boolean updateXML=false)
 Add the desired Folder object to the XMLExport. More...
 
boolean addNumberRange (String name, boolean withCounter=false)
 Add the desired number range alias to the XMLExport. More...
 
boolean addOutbar (String outbarName)
 Add the desired outbar to the XMLExport. More...
 
boolean addPartnerAccount (var userAccount, boolean includePrivateFolders=true)
 Add the desired user account (not fellow) to the XMLExport. More...
 
boolean addPortalScript (String namePattern, String format="5.0")
 Add all PortalScripts with the desired name pattern to the XMLExport. More...
 
boolean addPortalScriptCall (String nameScript)
 Defines a PortalScript, that will be executed after the XML-import. More...
 
boolean addPortalScriptsFromCategory (String nameCategory, String format="5.0")
 Add all PortalScripts belonging to the specified category to the XMLExport. More...
 
boolean addSystemUser (var systemUser, boolean includePrivateFolders=true)
 Add the desired SystemUser (user account or fellow) to the XMLExport. More...
 
boolean addWorkflow (String workflowName)
 Add the desired workflow to the XMLExport. More...
 
boolean clearXML ()
 Remove all references to DocFile objects from the XMLExport object. More...
 
String getLastError ()
 Function to get the description of the last error that occurred. More...
 
String getXML ()
 Retrieve the XML structure of the DocFile objects already added to the XMLExport. More...
 
boolean saveXML ()
 Performs the final save process of the XML structure. More...
 
XMLExport XMLExport (String pathFileName, boolean exportDocFile=true)
 Create a new instance of the XMLExport class. More...
 

Detailed Description

The XMLExport class allows to export DOCUMENTS elements as an XML file by scripting means.

The exported XML structure may then, for example, be used for further manipulation by an external ERP environment. The following elements can be exported:

The XML files may also be reimported into another (or the same) Portal environment by the Docimport application for DocFile objects and by the XML-import of DOCUMENTS Manager for the remaining elements, respectively.

Since
ELC 3.51b / otrisPORTAL 5.1b available for DocFile
DOCUMENTS 4.0c available for PortalScript, Filetype, Folder, Workflow, Distribution List, Editor, AccessProfile, Alias and Filing Plan
DOCUMENTS 4.0d available for Outbar
DOCUMENTS 4.0e available for DocumentsSettings
DOCUMENTS 5.0d available for CustomProperties
Example:
var f = context.file;
if (f)
{
// create a new XMLExport
var xml = new XMLExport("c:\\tmp\\" + f.getAutoText("id") + ".xml");
xml.addFile(f); // add the current file to the export
xml.saveXML(); // perform the export operation
var xmlString = xml.getXML(); // get XML as String for further use
xml.clearXML(); // empty XMLExport object
}

Constructor & Destructor Documentation

◆ XMLExport()

XMLExport XMLExport::XMLExport ( String  pathFileName,
boolean  exportDocFile = true 
)

Create a new instance of the XMLExport class.

The constructor is neccessary to initialize the XMLExport object with some basic settings. The pathFileName parameter is mandatory, the path must be an existing directory structure, and the target file should not yet exist in that directory structure.

Parameters
pathFileNameString containing full path and file name of the desired target output XML file
exportDocFileOptional boolean value:
  • true indicating that the created XMLExport instance is only able to export DocFile objects;
  • false indicating the created XMLExport instance is able to export the following elements:
    • PortalScript
    • Filetype
    • Folder
    • Workflow
    • Distribution List
    • Editor (Fellow)
    • AccessProfile
    • Alias
    • Filing Plan
    • Outbar
    • DocumentsSettings
    • CustomProperties
The default value is true.
Returns
XMLExport object, preinitialised to the desired target output path
Since
ELC 3.51b / otrisPORTAL 5.1b
DOCUMENTS 4.0c (new parameter exportDocFile)

Member Function Documentation

◆ addAccessProfile()

boolean XMLExport::addAccessProfile ( var  accessProfile)

Add the desired access profile to the XMLExport.

Parameters
accessProfileThe desired access profile to be added to the XML output and specified as follows:
  • String containing the technical name of the access profile
  • AccessProfile object
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var path = "C:\\temp\\expAccessProfile.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addAccessProfile("AccessProfile1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addAlias()

boolean XMLExport::addAlias ( String  aliasName)

Add the desired alias to the XMLExport.

Parameters
aliasNameString value containing the technical name of the alias to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var xmlExp = new XMLExport("C:\\temp\\expAlias.xml", false);
var success = xmlExp.addAlias("alias1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addCustomProperty()

boolean XMLExport::addCustomProperty ( String  propName)

Add the desired global custom property to the XMLExport.

Parameters
propNameThe technical name of the desired global custom property to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0d
Example:
var path = "C:\\temp\\expCustomProperty.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addCustomProperty("testProp");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addDistributionList()

boolean XMLExport::addDistributionList ( String  distributionListName)

Add the desired distribution list to the XMLExport.

Parameters
distributionListNameString containing the name of the distribution list to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var path = "C:\\temp\\expDistributionList.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addDistributionList("DistributionList1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addDocumentsSettings()

boolean XMLExport::addDocumentsSettings ( )

Add the DOCUMENTS settings data to the XMLExport.

Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0e

◆ addFellow()

boolean XMLExport::addFellow ( var  editor,
boolean  includePrivateFolders = true 
)

Add the desired editor (fellow) to the XMLExport.

Parameters
editorThe editor to be added to the XML output and specified as follows:
  • String containing the login name of the editor.
  • SystemUser object representing the editor.
includePrivateFoldersboolean value indicating whether to export the private folders of the fellow
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
DOCUMENTS 4.0c HF2 (new parameter includePrivateFolders)
Example:
var path = "C:\\temp\\expFellow.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addFellow("editor1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFile()

boolean XMLExport::addFile ( DocFile  docFile,
var  exportCondition = true 
)

Add the desired DocFile object to the XMLExport.

Parameters
docFileAn object of the DocFile class which should be added to the XML output
exportConditionOptional export conditions specified as follows:
  • boolean value indicating whether the file id should be exported as update key.
  • XMLExportDescription object defining serveral conditions for the exporting process of the DocFile object.
The default value is true.
Returns
true if successful, false in case of any error
Since
ELC 3.51b / otrisPORTAL 5.1b
Example:
var path = "C:\\temp\\expDocFile.xml";
var xmlExp = new XMLExport(path, true);
var success = xmlExp.addFile(context.file);
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFileType()

boolean XMLExport::addFileType ( String  fileTypeName)

Add the desired file type to the XMLExport.

The XML output is able to update the same file type (Update-XML).

Parameters
fileTypeNameThe technical name of the file type to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var path = "C:\\temp\\expFileType.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addFileType("Filetype1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFileTypesFromCategory()

boolean XMLExport::addFileTypesFromCategory ( String  categoryName)

Add all file types belonging to the specified category to the XMLExport.

The XML output is able to update the same file types (Update-XML).

Parameters
categoryNameThe category name of the file types to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0e
Example:
var path = "C:\\temp\\expFileTypesFromCategory.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addFileTypesFromCategory("ftCategory");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFileTypesFromFolder()

boolean XMLExport::addFileTypesFromFolder ( String  folderName)

Add all file types belonging to the specified file type folder to the XMLExport.

The XML output is able to update the same file types (Update-XML).

Parameters
folderNameThe folder name of the file types to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0e
Example:
var path = "C:\\temp\\expFileTypesFromFolder.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addFileTypesFromFolder("ftFolder");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFilingPlan()

boolean XMLExport::addFilingPlan ( String  filingPlanName)

Add the desired filing plan to the XMLExport.

The XML output is able to update the same filing plan (Update-XML).

Parameters
filingPlanNameString containing the technical name of the filing plan to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var path = "C:\\temp\\expFilingPlan.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addFilingPlan("myFilingPlan");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addFolder()

boolean XMLExport::addFolder ( Folder  folder,
boolean  exportStructure,
var  exportCondition,
boolean  updateXML = false 
)

Add the desired Folder object to the XMLExport.

This function is able to add the folder structure or the files in the folder to the XMLExport.

Parameters
folderThe Folder object to be added to the XML output.
exportStructureBoolean value indicating whether to export the folder structure or the files in the folder, on which the current user has read rights. If you want to export the files in the folder, an XMLExport instance being able to export DocFile should be used.
exportConditionThe export conditions can be specified as follows:
  • boolean value
    • indicating whether the file id should be exported as update key in case of exporting files in the folder;
    • indicating whether the subfolders should be exported in case of exporting the folder structure.
  • XMLExportDescription object defining several conditions for the exporting process of the files in the folder.
updateXMLOptional boolean value indicating whether the XML output is able to update the same folder (Update-XML) in case of exporting the folder structure. The default value is false.
Note: This Parameter is ignored in case of exporting the files in the folder.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
DOCUMENTS 5.0e HF2 (optional parameter updateXML)
Example:
var xmlExpFiles = new XMLExport("C:\\temp\\expFolderFiles.xml", true); // for exporting the files in the folder
var xmlExpStructure = new XMLExport("C:\\temp\\expFolderStructure.xml", false); // for exporting the folder structure
var it = context.getFoldersByName("myFolder", "dynamicpublic");
var folder = it.first();
if (folder)
{
var success = xmlExpFiles.addFolder(folder, false, true); // add the files in the folder to the XML output
if (success)
xmlExpFiles.saveXML();
success = xmlExpStructure.addFolder(folder, true, true); // add the folder structure to the XML output
if (success)
xmlExpStructure.saveXML();
}

◆ addNumberRange()

boolean XMLExport::addNumberRange ( String  name,
boolean  withCounter = false 
)

Add the desired number range alias to the XMLExport.

Parameters
nameString value containing the technical name of the number range to be added to the XML output.
withCounterboolean value indicating whether to export the actual counter value of the number range
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0d HF1

◆ addOutbar()

boolean XMLExport::addOutbar ( String  outbarName)

Add the desired outbar to the XMLExport.

Parameters
outbarNameString value containing the technical name of the outbar to be added to the XML output.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0d
Example:
var xmlExp = new XMLExport("C:\\temp\\expOutbar.xml", false);
var success = xmlExp.addOutbar("outbar1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addPartnerAccount()

boolean XMLExport::addPartnerAccount ( var  userAccount,
boolean  includePrivateFolders = true 
)

Add the desired user account (not fellow) to the XMLExport.

Parameters
userAccountThe user account to be added to the XML output and specified as follows:
  • String containing the login name of the user account.
  • SystemUser object representing the user account.
includePrivateFoldersboolean value indicating whether to export the private folders of the user account
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0 HF2
Example:
var path = "C:\\temp\\expUserAccount.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addPartnerAccount("login1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addPortalScript()

boolean XMLExport::addPortalScript ( String  namePattern,
String  format = "5.0" 
)

Add all PortalScripts with the desired name pattern to the XMLExport.

Parameters
namePatternThe name pattern of the PortalScripts to be added to the XML output.
formatOptional String value defining the desired export format. The following formats are available:
  • 4.0 (DOCUMENTS 4.0)
  • 5.0 (DOCUMENTS 5.0)
The default value is "5.0".
Note
The XML files exported in DOCUMENTS 5.0 format are incompatible with DOCUMENTS 4.0.
Returns
true if successful, false in case of any error
Example:
var path = "C:\\temp\\expPortalScript.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addPortalScript("test*", "4.0");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());
Since
DOCUMENTS 4.0c
DOCUMENTS 5.0 HF1 (default format is 5.0)

◆ addPortalScriptCall()

boolean XMLExport::addPortalScriptCall ( String  nameScript)

Defines a PortalScript, that will be executed after the XML-import.

This method does not export the content of a PortalScript (see XMLExport.addPortalScript()), but executes a PortalScript at the end of the XML-Import of the whole xml file.

Parameters
nameScriptThe name of the PortalScript, that should be executed.
Returns
true if successful, false in case of any error
Example:
var path = "C:\\temp\\expPortalScript.xml";
var xmlExp = new XMLExport(path, false);
...
var success = xmlExp.addPortalScriptCall("updateSolution");
...
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());
Since
DOCUMENTS 5.0c HF1

◆ addPortalScriptsFromCategory()

boolean XMLExport::addPortalScriptsFromCategory ( String  nameCategory,
String  format = "5.0" 
)

Add all PortalScripts belonging to the specified category to the XMLExport.

Parameters
nameCategoryThe category name of the PortalScripts to be added to the XML output.
formatOptional String value defining the desired export format. The following formats are available:
  • 4.0 (DOCUMENTS 4.0)
  • 4.0 (DOCUMENTS 5.0)
The default value is "5.0".
Note
The XML files exported in DOCUMENTS 5.0 format are incompatible with DOCUMENTS 4.0.
Returns
true if successful, false in case of any error
Example:
var path = "C:\\temp\\expPortalScript.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addPortalScriptsFromCategory("testScripts", "5.0");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());
Since
DOCUMENTS 4.0d HF1
DOCUMENTS 5.0 HF1 (default format is 5.0)

◆ addSystemUser()

boolean XMLExport::addSystemUser ( var  systemUser,
boolean  includePrivateFolders = true 
)

Add the desired SystemUser (user account or fellow) to the XMLExport.

Parameters
systemUserThe SystemUser to be added to the XML output and specified as follows:
  • String containing the login name of the SystemUser.
  • SystemUser object representing the user account.
includePrivateFoldersboolean value indicating whether to export the private folders of the SystemUser
Returns
true if successful, false in case of any error
Since
DOCUMENTS 5.0 HF2
Example:
var path = "C:\\temp\\expSystemUser.xml";
var xmlExp = new XMLExport(path, false);
var success = xmlExp.addSystemUser("login1");
if (success)
xmlExp.saveXML();
else
util.out(xmlExp.getLastError());

◆ addWorkflow()

boolean XMLExport::addWorkflow ( String  workflowName)

Add the desired workflow to the XMLExport.

Parameters
workflowNameString containing the technical name and optional the version number of the workflow to be added to the XML output. The format of the workflowName is technicalName[-version]. If you don't specify the version of the workflow, the workflow with the highest workflow version number will be used. If you want to add a specific version, you have to use technicalName-version e.g. "Invoice-2" as workflowName.
Returns
true if successful, false in case of any error
Since
DOCUMENTS 4.0c
Example:
var path = "C:\\temp\\expWorkflow.xml";
var xmlExp = new XMLExport(path, false);
xmlExp.addWorkflow("Invoice"); // add the latest version of the workflow "Invoice"
xmlExp.addWorkflow("Invoice-2"); // add the version 2 of the workflow "Invoice"
xmlExp.saveXML();

◆ clearXML()

boolean XMLExport::clearXML ( )

Remove all references to DocFile objects from the XMLExport object.

After the execution of this method the XMLExport object is in the same state as right after its construction.

Returns
true if successful, false in case of any error
Since
ELC 3.51b / otrisPORTAL 5.1b

◆ getLastError()

String XMLExport::getLastError ( )

Function to get the description of the last error that occurred.

Returns
Text of the last error as String
Since
ELC 3.51b / otrisPORTAL 5.1b
See also
DocFile.getLastError()

◆ getXML()

String XMLExport::getXML ( )

Retrieve the XML structure of the DocFile objects already added to the XMLExport.

The XML structure is returned as a String, so it is possible to further manipulate it (e.g. with the E4X scripting extension (not discussed in this documentation) before outputting it to its final destination.

Returns
String containing the complete XMl structure of the XMLExport
Since
ELC 3.51b / otrisPORTAL 5.1b

◆ saveXML()

boolean XMLExport::saveXML ( )

Performs the final save process of the XML structure.

Not earlier than when executing this instruction the XML file is created in the target file path.

Returns
true if successful, false in case of any error
Since
ELC 3.51b / otrisPORTAL 5.1b

This documentation refers DOCUMENTS 5.0e (2105).
Created at 11-09-2019. - © 1998-2019 otris software AG, Königswall 21, D-44137 Dortmund. support@otris.de