6.5.4 Delete

Delete is used to delete the user specified object or data from the active or specified landmark database. It accepts a set of input parameters that define the Type and data for performing the delete operation. It is available only in synchronous mode.

The following is an example for using Delete:

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

The following table summarizes the specification of Delete:

Interface IDataSource
Description Deletes an object from the active or specified landmark database.
Response Model Synchronous
Pre-condition IDataSource interface is loaded.
Post-condition The default or active database opened for reading landmarks and categories. A default database is created, if it does not exist and is set as active.

A Landmark/category is deleted from an active or specified database.

Deleting a database, deletes it from terminal.


Input Parameters

Input parameter specifies the Type Landmark/category to delete and details of the particular Type.

Table 6.98: Input parameters for Delete
Name Type Range Description
Type unicode string Landmark
Category
Performs operation based on the specified content types.
Data Landmark
map
[DatabaseURI]: unicode string
ID: unicode string

Category
map
[DatabaseURI]: unicode string
ID: unicode string

NA the Type Landmark/Category to delete and details of the particular Type.

ID is a mandatory field for deleting a landmark and category object.


Output Parameters

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

Table 6.99: Output parameters for Delete
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.100: Error codes
Error code value Description
1002 Bad argument type
1003 Missing argument
1004 Service not supported
1006 Service not ready
1011 Access denied


Error Messages

The following table lists the error messages and their description:


Table 6.101: Error messages
Error messages Description
Landmarks:Delete:Type or Data is missing Indicates Type is missing or data type of Type is mismatched.
Landmarks:Delete:Type is invalid Indicates that Type is not a value in the given range.
Landmarks:Delete:Data is missing Indicates Data is missing or data type of Data is mismatched.
Landmarks:Delete:Id is missing Indicates ID is missing or data type of ID is mismatched.
Landmarks:Delete:DatabaseURI is missing Indicates DatabaseURI is missing or data type of DatabaseURI is mismatched.


Example

The following sample code illustrates how to delete an object from the active / specified landmark database:

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 = retval['id']
        delete_output = landmark_handle.call('Delete',{'Type': u'Landmark',
                                                       'Data': {'id': unicode(id)}})
        delete_error = delete_output['ErrorCode']
        if delete_error != 0:
            print "Error in deleting landmark"
        else:
            print "Landmark deleted"
except scriptext.ScriptextError, err:
    print "Error performing the operation : ", err

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