6.5.6 Export

Export is used to exports a specified set of Landmarks. It is available only in synchronous mode.

The following is an example for using Export:

getlist_output = landmark_handle.call('GetList', {'Type': u'Landmark',
                                                  'Filter': {'LandmarkName': u'land1'}})

The following table summarizes the specification of Export:

Interface IDataSource
Description Imports a set of Landmarks.
Response Model Synchronous
Pre-condition IDataSource interface is loaded.
Post-condition The default or active database is opened for reading landmarks and categories. A default database is created, if it does not exist and is set as active.

Landmarks is exported to the specified file.


Input Parameters

Input parameter specifies the Type and Data for performing the operation.

Table 6.106: Input parameters for Export
Name Type Range Description
Type unicode string Landmark Performs operation based on the specified content types.
Data map
[DatabaseURI]: unicode string
DestinationFile: unicode string
IdList: List (Lmid1, Lmid2)
MimeType: unicode string
NA DatabaseURI: Export landmarks from this database. If this is not specified landmarks/categories is exported from default database.

DestinationFile: Export landmarks to this file. Complete file path must be specified.

IdList: List of landmark Ids.

MimeType: Encoding algorithm.

You must specify the Mime type of the landmark content. Mime enables the inclusion of media other than plain text and the inclusion of several entities in one single message.

Supported Mime types:

application/vnd.nokia.landmarkcollection+xml.


Output Parameters

Output parameters contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.107: Output parameters for Export
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.


Errors

The following table lists the error codes and their values:

Table 6.108: Error codes
Error code value Description
-301 No Service
1002 Bad argument type
1003 Missing argument
1004 Service not supported
1010 Entry exists
1017 Path not found


Error Messages

The following table lists the error messages and their description:


Table 6.109: Error messages
Error messages Description
Landmarks:Export:Type or Data is missing Indicates Type is missing or data type of Type is mismatched.
Landmarks:Export:Type is invalid Indicates that Type is not a value in the given range.
Landmarks:Export:Data is missing Indicates Data is missing or data type of Data is mismatched.
Landmarks:Export:MimeType is missing Indicates MimeType is missing or data type of MimeType is mismatched.
Landmarks:Export:DestinationFile is missing Indicates DestinationFile is missing or data type of DestinationFile is mismatched.
Landmarks:Export:IdList is missing Indicates IdList is missing or data type of IdList is mismatched.
Landmarks:Export:IdList is empty Indicates IdList is empty.


Example

The following sample code illustrates how to export a set of landmarks:

import scriptext

landmark_handle = scriptext.load('Service.Landmarks', 'IDataSource')
try:
    getlist_output = landmark_handle.call('GetList', {'Type': u'Landmark', 
                                                      'Filter': {'LandmarkName': u'land1'}})
    getlist_error = getlist_output['ErrorCode']
    if getlist_error != 0:
        print "GetList error"
    else:
        retval = getlist_output['ReturnValue']
        id_val = retval['id']
        export_output = landmark_handle.call('Export', {'Type':  u'Landmark',
                                                        'Data': {'DestinationFile':
                                                                   u'c:\data\export_land.txt',
                                                                 'idList': [id_val],
                                                                 'MimeType': 
                                                                   'application/vnd.nokia.landmarkcollection+xml'}})
        export_error = export_output['ErrorCode']
        if export_error != 0:
            print "Export unsuccessful"
        else:
            print "Landmark ecported"

except scriptext.ScriptextError, err:
    print "Error performing the operation : ", err

See About this document... for information on suggesting changes.