TaskRunner Objects

The TaskRunner provides a convenient way of creating and running tasks synchronously.

t.createStream(name, autoConnect, autoManage) : Stream

name (string) : the object's name

autoConnect (boolean) : whether the stream should be auto-connected to the server

autoManage (boolean) : whether the stream should be added to the stream manager

Creates and returns a new Stream. Note that code that needs to create streams privately without having them made visible to the user should set the autoManage flag to False.

Exceptions:

ServerConnectionException : if the Session is already connected and the auto-connect flag is True but a new connection could not be created for the stream

t.exportDocumentToFile(documentOutput, filename, fileFormat)

documentOutput (DocumentOutput) : the document to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format

Exports the stream description to a file using the specified file format.

Exceptions:

OwnerException : if the document is not owned by the task runner session

SessionException : if the document cannot be exported for some reason

ExportFormatException : if the document does not support the export format

t.exportModelSummaryToFile(modelOutput, filename, fileFormat)

modelOutput (ModelOutput) : the model to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format which is either FileFormat.PLAIN_TEXT or FileFormat.HTML.

Exports the model summary to a file using the specified file format. Model summaries can only be exported as text or HTML.

Exceptions:

OwnerException : if the model is not owned by the task runner session

SessionException : if the model cannot be exported for some reason

ExportFormatException : if the model does not support the export format

t.exportModelSummaryToFile(node, filename, fileFormat)

modelOutput (Node) : the model applier node to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format which is either FileFormat.PLAIN_TEXT or FileFormat.HTML.

Exports the model summary in the supplied node to a file using the specified file format. Model summaries can only be exported as text or HTML.

Exceptions:

OwnerException : if the model is not owned by the task runner session

SessionException : if the model cannot be exported for some reason

ExportFormatException : if the model does not support the export format

t.exportModelToFile(modelOutput, filename, fileFormat)

modelOutput (ModelOutput) : the model to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format

Exports the model to a file using the specified file format.

Exceptions:

OwnerException : if the model is not owned by the task runner session

SessionException : if the model cannot be exported for some reason

ExportFormatException : if the model does not support the export format

t.exportModelToFile(node, filename, fileFormat)

modelOutput (Node) : the model applier node to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format

Exports the model in the supplied node to a file using the specified file format.

Exceptions:

OwnerException : if the model is not owned by the task runner session

SessionException : if the model cannot be exported for some reason

ExportFormatException : if the model does not support the export format

t.exportOutputToFile(object, filename, fileFormat, options)

object (PropertiedObject) : the object with the output content

filename (string) : the file name where the output should be exported to

fileFormat (FileFormat) : the file format

options (Map) : either None or a hash table of attribute values

Exports the output content from the supplied object to the specified file and format. The following document formats are supported:

  • FileFormat.PLAIN_TEXT
  • FileFormat.HTML
  • FileFormat.RTF
  • FileFormat.SPV
  • FileFormat.SPW
  • FileFormat.SPSS_WEB_REPORT
  • FileFormat.COGNOS_ACTIVE_REPORT
  • FileFormat.PDF
  • FileFormat.MS_EXCEL
  • FileFormat.MS_EXCEL2007
  • FileFormat.MS_EXCEL2007_M
  • FileFormat.MS_POWERPOINT

The following image formats are supported:

  • FileFormat.BITMAP
  • FileFormat.PNG
  • FileFormat.JPEG
  • FileFormat.TIFF

If options are supplied, the value is a table of attribute/value pairs. For document exports, the options are:

  • alternate_log_file_location (string): the location of the log file if this is to be expored separately
  • custom_report_title (string): a custom title for a web report
  • excel_location_option ("AddColumns", "AddRows", "OverwriteAtCellRef"): where the content should be exported to in Excel
  • excel_operation_option ("CreateWorkbook", "CreateWorksheet", "ModifyWorksheet"): how the content should be exported to Excel
  • excel_sheetname (string): the Excel sheet name
  • excel_starting_cell_ref (string): the Excel starting cell references
  • export_html_headers (Boolean): whether to export HTML headers
  • export_image_maps (Boolean): whether to create image maps
  • export_images (Boolean): whether images should be exported separately for formats that don't support images
  • html_with_style (Boolean): whether style information should be saved
  • include_footnotes_and_captions (Boolean): whether footnotes and captions should be included
  • interactive_layer (Boolean): whether an interactive layer should be included in formats that support them
  • is_logs_excluded (Boolean): whether exclude logs
  • is_notes_excluded (Boolean): whether to exclude notes
  • is_text_excluded (Boolean): whether to exclude text content
  • javascript_file_name (string): for interactive output, the location of the JavaScript file if separate
  • model_view_option ("MVExportAll", "MVExportVisible", "MVPrintSetting"): which model views should be exported
  • page_break_between_table (Boolean): whether to create a page break between tables
  • page_setup (Map): the page setup settings (see below)
  • pdf_embed_bookmarks (Boolean): whether to embed bookmarks in PDF document
  • pdf_embed_fonts (Boolean): whether to embed fonts in the PDF document
  • pivot_table_option ("PTExportAllLayers", "PTExportVisibleLayers", "PTUsePrintLayerSetting"): how pivot tables should be handled
  • ppt_use_viewer_outlines (Boolean): whether to use viewer outlines in the PowerPoint
  • preserve_break_points (Boolean): whether to preserve break points
  • table_style (string): the name of the table style
  • text_encoding ("utf8", "utf16"): what text encoding to use in text files
  • text_doc_option ("TxtUseSpaces", "TxtUseTabs"): whether to uses spaces or tabs in text files
  • text_width_autofit (Boolean): whether to make table columns fit the content in text files
  • txt_column_width (integer): if table columns are not fitted to their content in text files, defines the column width
  • col_txt_border_character (character): the table column character when exporting to a text file
  • row_txt_border_character (character): the table column character when exporting to a text file
  • viewer_doc_name (string): the name of the document which should be displayed in the viewer
  • wide_tables_option ("WT_Extend", "WT_Shrink", "WT_Wrap"): defines how wide tables should be handled

For graph exports, the options are:

  • bmp_compress_image (Boolean): whether to compress bitmap images
  • graph_image_size (integer): how much to scale the exported image as a percentage of the original
  • graph_invert_colors (Boolean): whether to invert the colors
  • graph_type ("BMP", "JPG", "PNG", "TIF"): defines the graph type to be used when exporting images separately from the non-image content
  • model_view_option ("MVExportAll", "MVExportVisible", "MVPrintSetting"): which model views should be exported
  • png_color_depth ("BlackWhite", "Grays", "SixteenColors", "TrueColor24", "TrueColor36", "TwoFiftySixColors"): the color depth when exporting to PNG
  • tiff_color_space ("CMYK", "RGB"): the color space when exporting to TIF
  • tiff_compress_image (Boolean): whether to compress TIF images

For the page_setup, the options are:

  • height (Double): the page height
  • width (Double): the page width
  • bottom_margin (Double): the bottom margin
  • left_margin (Double): the left margin
  • right_margin (Double): the right margin
  • top_margin (Double): the top margin
  • orientation (Integer): 0 for portrait, 1 for landscape
  • units ("Centimeters", "Millimeters", "Inches", "PrintPoints"): the units that the margin and dimension values represent

Exceptions:

OwnerException : if the object is not owned by the current session

ExportFormatException : if the export format is not supported

SessionException : if some other error occurs

t.exportStreamToFile(stream, filename, fileFormat)

stream (Stream) : the stream to be exported

filename (string) : the exported file path

fileFormat (FileFormat) : the export file format

Exports the stream description to a file using the specified file format.

Exceptions:

OwnerException : if the stream is not owned by the task runner session

SessionException : if the stream cannot be exported for some reason

ExportFormatException : if the stream does not support the export format

t.insertNodeFromFile(filename, diagram) : Node

filename (string) : the file path

diagram (Diagram) : the diagram that the node should be inserted into

Reads and returns a node from the specified file, inserting it into the supplied diagram. Note that this can be used to read both Node and SuperNode objects.

Exceptions:

OwnerException : if the diagram is not owned by the task runner session

SessionException : if the node cannot be loaded for some reason

ObjectLockedException : if the stream that the node is being added to is locked

t.openDocumentFromFile(filename, autoManage) : DocumentOutput

filename (string) : the document file path

autoManage (boolean) : whether the document should be added to the output manager

Reads and returns a document from the specified file.

Exceptions:

SessionException : if the document cannot be loaded for some reason

t.openModelFromFile(filename, autoManage) : ModelOutput

filename (string) : the model file path

autoManage (boolean) : whether the model should be added to the model manager

Reads and returns a model from the specified file.

Exceptions:

SessionException : if the model cannot be loaded for some reason

t.openStreamFromFile(filename, autoManage) : Stream

filename (string) : the stream file path

autoManage (boolean) : whether the stream should be added to the stream manager

Reads and returns a stream from the specified file.

Exceptions:

SessionException : if the stream cannot be loaded for some reason

t.saveDocumentToFile(documentOutput, filename)

documentOutput (DocumentOutput) : the document to be saved

filename (string) : the document file path

Saves the document to the specified file location.

Exceptions:

OwnerException : if the document is not owned by the task runner session

SessionException : if the document cannot be saved for some reason

t.saveModelToFile(modelOutput, filename)

modelOutput (ModelOutput) : the model to be saved

filename (string) : the model file path

Saves the model to the specified file location.

Exceptions:

OwnerException : if the model is not owned by the task runner session

SessionException : if the model cannot be saved for some reason

t.saveNodeToFile(node, filename)

node (Node) : the node to be saved

filename (string) : the node file path

Saves the model to the specified file location.

Exceptions:

OwnerException : if the node is not owned by the task runner session

SessionException : if the node cannot be saved for some reason

t.saveStreamToFile(stream, filename)

stream (Stream) : the stream to be saved

filename (string) : the stream file path

Saves the stream to the specified file location.

Exceptions:

OwnerException : if the stream is not owned by the task runner session

SessionException : if the stream cannot be saved for some reason