Complex Attribute Types

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. The MBO examples have attributes that are primitive types (such as int, long, or string), and make use of the basic database operations (create, update, and delete).

Passing Structures to Operations

An Unwired WorkSpace project includes an example MBO that is bound to a Web service data source that includes a create operation that takes a structure as an operation parameter. MBOs differ depending on the data source, configuration, and so on, but the principles are similar.

The SimpleCaseList MBO contains a create operation that has a number of parameters, including one named _HEADER_ that is a structure datatype named AuthenticationInfo, defined as:
AuthenticationInfo
   userName: String
   password: String
   authentication: String
   locale: String
   timeZone: String
Structures are implemented as classes, so the parameter _HEADER_ is an instance of the AuthenticationInfo class. The generated code for the create operation is:
public  void create(complex.AuthenticationInfo _HEADER_,java.lang.String escalated,java.lang.String 
hotlist,java.lang.String orig_Submitter,java.lang.String pending,java.lang.String workLog)

This example demonstrates how to initialize the AuthenticationInfo class instance and pass it, along with the other operation parameters, to the create operation:

AuthenticationInfo authen = new AuthenticationInfo();
		authen.setUserName("Demo");
		authen.setPassword("");
		authen.setAuthentication("");
		authen.setLocale("EN_US");
		authen.setTimeZone("GMT");

		SimpleCaseList newCase = new SimpleCaseList();
		newCase.setCase_Type("Incident");
		newCase.setCategory("Networking");
		newCase.setDepartment("Marketing");
		newCase.setDescription("A new help desk case.");
		newCase.setItem("Configuration");
		newCase.setOffice("#3 Sybase Drive");
		newCase.setSubmitted_By("Demo");
		newCase.setPhone_Number("#0861023242526");
		newCase.setPriority("High");
		newCase.setRegion("USA");
		newCase.setRequest_Urgency("High");
		newCase.setRequester_Login_Name("Demo");
		newCase.setRequester_Name("Demo");
		newCase.setSite("25 Bay St, Mountain View, CA");
		newCase.setSource("Requester");
		newCase.setStatus("Assigned");
		newCase.setSummary("MarkHellous was here Fix it.");
		newCase.setType("Access to Files/Drives");
		newCase.setCreate_Time(new
		java.sql.Timestamp(System.currentTimeMillis()));

		newCase.create(authen, "Other", "Other", "Demo", "false", "worklog");
		newCase.submitPending();