Complex Attribute Types

The MBO examples previously described have attributes that are primitive types (such as int, long, string), and make use of the basic database operations (create, update, and delete). To support interactions with certain back-end datasources, such as SAP® and Web services, an MBO may have more complex attributes: an integer or string list, a class or MBO object, or a list of objects. Some back-end datasources require complex types to be passed in as input parameters. The input parameters can be any of the allowed attribute types, including primitive lists, objects, and object lists.

In the following example, a Sybase Unwired Platform project is created to interact with a Remedy Web service back-end. The project includes two MBOs, HelpDesk_Query_Service and HelpDesk_QueryList_Service.

Note: Each project will have different requirements because each back-end datasource requires a different configuration for parameters to be sent to successfully execute a database operation.

MBOs for Complex Attribute Types

You can determine from viewing the properties of the create operation, helpdesk_Submit_Service(), that the operation requires parameters to be passed in. The first parameter, _HEADER_, is an instance of the AuthenticationInfo class, and the second parameter, assigned_Group, is a list of strings.


MBO Parameter Properties for Complex Attribute Types

When you generate iOS code for this project, the generated code includes the RemedyCU_AuthenticationInfo class, in addition to the MBO classes RemedyCU_HelpDesk_Query_Service and RemedyCU_HelpDesk_QueryList_Service. The AuthenticationInfo class holds information that must be passed to the Unwired Server to authenticate database operations.

The project includes the create operation helpdesk_Submit_Service. Call this method instead of using the iOS MBO create method directly. The helpdesk_Submit_Service method is defined in RemedyCU_HelpDesk_Query_Service.h:

- (void)helpDesk_Submit_Service:(RemedyCU_AuthenticationInfo*)_HEADER_ 
withAssigned_Group:(SUPNullableStringList*)assigned_Group 
withCI_Name:(NSString*)cI_Name 
withLookup_Keyword:(NSString*)lookup_Keyword 
withResolution_Category_Tier_1:(NSString*)resolution_Category_Tier_1 
withAction:(NSString*)action 
withCreate_Request:(NSString*)create_Request 
withWork_Info_Summary:(NSString*)work_Info_Summary 
withWork_Info_Notes:(NSString*)work_Info_Notes 
withWork_Info_Type:(NSString*)work_Info_Type 
withWork_Info_Date:(NSDate*)work_Info_Date 
withWork_Info_Source:(NSString*)work_Info_Source 
withWork_Info_Locked:(NSString*)work_Info_Locked 
withWork_Info_View_Access:(NSString*)work_Info_View_Access 
withMiddle_Initial:(SUPNullableStringList*)middle_Initial 
withDirect_Contact_First_Name:(NSString*)direct_Contact_First_Name 
withDirect_Contact_Middle_Initial:(NSString*)direct_Contact_Middle_Initial 
withDirect_Contact_Last_Name:(NSString*)direct_Contact_Last_Name 
withTemplateID:(NSString*)templateID;

The following code example initializes a Remedy instance of the HelpDesk_Query_Service MBO on the device, creates the instance in the client database, and submits it to the Unwired Server. The example shows how to initialize the AuthorizationInfo class instance and the assigned_Group string list, and pass them as parameters into the create operation.

RemedyCU_AuthenticationInfo* authinfo;
  int64_t key= 0;
  authinfo = [RemedyCU_AuthenticationInfo getInstance];
  authinfo.userName=@"Francie";
  authinfo.password=@"password";
  authinfo.authentication=nil;
  authinfo.locale=nil;
  authinfo.timeZone=nil;
    
  SUPNullableStringList *assignedgrp = [SUPNullableStringList getInstance];
  [assignedgrp add:@"Frontoffice Support"];
    
  RemedyCU_HelpDesk_Query_Service *cr = [[RemedyCU_HelpDesk_Query_Service alloc] init];
    
cr.company = @"Calbro Services";
  
[cr helpDesk_Submit_Service:authinfo 
  withAssigned_Group:assignedgrp 
  withCI_Name:nil
  withLookup_Keyword:nil
  withResolution_Category_Tier_1:nil
  withAction:@"CREATE"
  withCreate_Request:@"YES" 
  withWork_Info_Summary:[NSString stringWithFormat:@"create %@",[NSDate date]]
  withWork_Info_Notes:nil 
  withWork_Info_Type:nil 
  withWork_Info_Date:nil 
  withWork_Info_Source:nil
  withWork_Info_Locked:nil 
  withWork_Info_View_Access:nil
  withMiddle_Initial:nil 
  withDirect_Contact_First_Name:nil
  withDirect_Contact_Middle_Initial:nil 
  withDirect_Contact_Last_Name:nil
  withTemplateID:nil];
  
[cr submitPending];
// wait for response from server
while([RemedyCU_RemedyCUDB hasPendingOperations])
  [NSThread sleepForTimeInterval:1.0];
Related concepts
Query APIs
Related reference
Connection APIs
Synchronization APIs
Operations APIs
Local Business Object
Personalization APIs
Object State APIs
Security APIs
Utility APIs
Exceptions
MetaData and Object Manager API
Message-Based Synchronization APIs
Messaging Client API