6.5.7 Organise

Organise is used to associate or disassociate a list of landmarks in a database to a category. It accepts a set of parameters that defines the Type, data, and operation type for performing the operation. It is available only in synchronous mode.

The following is an example for using Organise:

org_output = landmark_handle.call('Organise', {'Type': u'Landmark', 
                                               'Data': {'id': unicode(cat_id),
                                               'idList': [id_val1,id_val2]},
                                               'Operation Type': 'Associate'})

The following table summarizes the specification of Organise:

Interface IDataSource
Description Associates or disassociates a list of landmarks in a database to a category.
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, data, and type of operation for performing the operation.

Table 6.110: Input parameters for Organise
Name Type Range Description
Type unicode string Landmark Performs operation based on the specified content types.
Data map
[DatabaseURI]: unicode string
Id: unicode string
IdList: List (Id1, Id2)
NA DatabaseURI: Organise landmarks in this database.

Id: Associate or disassociate landmarks to the category Id.

IdList: List of landmarks need to be organized.

OperationType unicode string OperationType:
Associate
Disassociate
NA


Output Parameters

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

Table 6.111: Output parameters for Organise
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.112: Error codes
Error code value Description
1002 Bad argument type
1003 Missing argument
1011 Access denied
1012 Item not found


Error Messages

The following table lists the error messages and their description:


Table 6.113: Error messages
Error messages Description
Landmarks:Organise:Type or Data or OperationType is missing Indicates Type is missing or data type of Content Type is mismatched.
Landmarks:Organise:Type is invalid Indicates that Type is not a value in the given range.
Landmarks:Organise:Data is missing Indicates Data is missing or data type of Data is mismatched.
Landmarks:Organise:Id is missing Indicates category Id is missing or data type of category Id is mismatched.
Landmarks:Organise:IdList is missing Indicates IdList is missing or data type of IdList is mismatched.
Landmarks:Organise:IdList is empty Indicates IdList is empty.
Landmarks:Organise:OperationType is missing Indicates OperationType is missing or data type of OperationType is mismatched.
Landmarks:Organise:OperationType is invalid Indicates OperationType is not a value in the given range.


Example

The following sample code illustrates how to associate or disassociate list of landmarks in a database to a category:

import scriptext

landmark_handle = scriptext.load('Service.Landmarks', 'IDataSource')
try:
    getlist_cat_output = landmark_handle.call('GetList', {'Type': u'Category'})
    retval_cat = getlist_cat_output['ReturnValue']
    cat_id = retval_cat['id']

    getlist_land1_output = landmark_handle.call('GetList', {'Type': u'Landmark',  
                                                       'Filter': {'LandmarkName': u'land1'}})
    retval1 = getlist_land1_output['ReturnValue']
    id_val1 = retval['id']

    getlist_land2_output = landmark_handle.call('GetList', {'Type': u'Landmark',
                                                       'Filter': {'LandmarkName': u'land2'}})
    retval2 = getlist_land2_output['ReturnValue']
    id_val2 = retval['id']

    org_output = landmark_handle.call('Organise', {'Type': u'Landmark', 
                                                   'Data': {'id': unicode(cat_id),
                                                            'idList': [id_val1,id_val2]},
                                                   'Operation Type': 'Associate'})
    error = org_output['ErrorCode']
    if error != 0:
        print "Error in organising contacts"
    else:
        print "Conatcs organised"

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

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