6.5.3 Add
Add
is used to add or modify an object to the active or specified landmark database. It accepts a set of input parameters that define the Type and its details to add. It is available only in synchronous mode.
The following is an example for using Add
:
add_output = landmark_handle.call('Add', {'Type': u'Landmark',
'Data': {'LandmarkName': u'land1'}})
The following table summarizes the specification of Add
:
Interface |
IDataSource |
Description |
Adds or Modifies an object to the active or specified landmark database. |
Response Model |
Synchronous |
Pre-condition |
IDataSource interface is loaded. Update is performed only on an existing landmark or category. You must provide ID of the landmark or category to update. The ID is retrieved by calling GetList . |
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.
Landmark/category is added or edited in the specified database or the active databases, in case database is not specified. A new database is created within a terminal, in case of addition of a new database. |
Input Parameters
Input parameter specifies what landmark information is returned and how the returned information is sorted.
Table 6.94:
Input parameters for Add
Name |
Type |
Range |
Description |
Type |
unicode string |
Landmark
Category |
Performs operation based on the specified content types. |
Data |
Landmark
map (LandmarkMap )
[DatabaseURI] : unicode string
Category
map (CategoryMap )
[DatabaseURI] : unicode string |
Landmark
DatabaseURI : The Uri of the database to which the landmark must be added or edited. If this is not specified then, landmark or category is added to default database.
LandmarkMap: The map containing the landmark fields which are added or edited.
Category
DatabaseURI : The Uri of the database to which the category must be added or edited.
CategoryMap: The map containing the category fields which are added or edited. |
Data Fields contain information about the object to be added.
Do not set the ID field to add a new landmark/category. For adding landmark/category you can make use of New .
Do not modify the ID field when editing an existing landmark/category which is retrieved from GetList . |
|
Output Parameters
Output parameters contain the requested information. They also contain ErrorCode
, and ErrorMessage
if the operation fails.
Table 6.95:
Output parameters for Add
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. |
ReturnValue |
string |
NA |
ID of the landmark/category that was added or modified. |
|
Errors
The following table lists the error codes and their values:
Table 6.96:
Error codes
Error code value |
Description |
-304 |
General Error |
0 |
Success |
1000 |
Invalid service argument |
1002 |
Bad argument type |
1003 |
Missing argument |
1004 |
Service not supported |
1006 |
Service not ready |
1011 |
Access denied |
1012 |
Item not found |
|
Error Messages
The following table lists the error messages and their description:
Table 6.97:
Error messages
Error messages |
Description |
Landmarks:Add:Type or Data is missing |
Indicates Type is missing or data type of Type is mismatched. |
Landmarks:Add:Type is invalid |
Indicates that Type is not a value in the given range. |
Landmarks:Add:Data is missing |
Indicates Data is missing or data type of Data is mismatched. |
Landmarks:Add:LandmarkPosition is missing |
Indicates LandmarkPostion is missing or data type of LandmarkPostion is mismatched. |
Landmarks:Add:CategoryInfo is missing |
Indicates CategoryInfo is missing or data type of CategoryInfo is mismatched. |
Landmarks:Add:IconIndex is missing |
Indicates IconIndex is missing or data type of IconIndex is mismatched. |
Landmarks:Add:LandmarkFields is missing |
Indicates LandmarkFields is missing or data type of LandmarkFields is mismatched. |
Landmarks:Add:CategoryName is missing |
Indicates CategoryName is missing or data type of CategoryName is mismatched. |
Landmarks:Add:DatabaseURI is missing |
Indicates DatabaseURI is missing or data type of DatabaseURI is mismatched. |
|
Example
The following sample code illustrates how to add or modify an object to the active / specified landmark database:
import scriptext
landmark_handle = scriptext.load('Service.Landmarks', 'IDataSource')
try:
add_output = landmark_handle.call('Add', {'Type': u'Landmark',
'Data': {'LandmarkName': u'land1'}})
error = add_output['ErrorCode']
if error != 0:
print "Error in adding the landmark"
else:
print "Landmark added"
except scriptext.ScriptextError, err:
print "Error performing the operation : ", err
Release 2.0.0 final , documentation updated on 10 Feb 2010.
See About this document... for information on suggesting changes.