IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Business objects programming > Programming model > Modeling business objects

Business object definition

IBM BPM provides a flexible mechanism for defining or importing business objects.

There are essentially three different forms of XML schema that IBM BPM recognizes as a business object definition:


Top-level complex type definition

This is an example of a top-level complex type definition:

<complexType name="ProductType">
	<sequence>
		<element name="name" type="string"/>
		<element name="color" type="string" maxOccurs="unbounded"/>
	</sequence>
</complexType>

Importing or defining business objects that are all defined using complex type definitions only is the most flexible and manageable scheme. The upside of this model is a type library that enables reuse. Reuse can be by three different methods.

The other implication of business objects defined as complex types is that when the complex type is used by the JService component kinds to transfer data within the runtime, in order to maintain WS-I compliance, an element needs to be created that references the named complex type.


Top-level anonymous complex type definition

This is an example of a top-level anonymous complex type definition:

<element name="Product">
	<complexType>	
		<sequence>
			<element name="name" type="string"/>
			<element name="color" type="string" maxOccurs="unbounded"/>
		</sequence>
	</complexType>
</element>

If the imported business objects are all anonymous element definitions, they are ready made to be included in JService invocations. However, they are not inherently reusable.


Top-level element referencing a named type

This is an example of a top-level element referencing a named type:

<element name="product" type="prod:ProdType"/>

Business objects that reference named complex types might be frequent in an environment that has already defined WSDL operations that require element definitions. In this scenario, it is important to consider the possible disposition of the complex type and element definitions:


Example

The example demonstrates all the mechanisms for defining a business object combined together.

<schema
	targetNamespace="http://www.app.com/Address"
	xmlns:addr="http://www.app.com/Address"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.w3.org/2001/XMLSchema">

	<complexType name="Address">
		<sequence>
			<element name="street1" type="string"/>
			<element name="street2" type="string"/>
			<element name="city" type="string"/>
			<element name="state" type="string"/>
			<element name="zip" type="string"/>
		</sequence>
	</complexType>

	<element name="homeAddress" type="addr:Address"/>
	<element name="workAddress" type="addr:Address"/>
	<element name="otherAddress" type="addr:Address"/>

	<element name="individualContact">
		<complexType>
			<sequence>
				<element name="firstName" type="string"/>
				<element name="lastName" type="string"/>
				<element ref="addr:HomeAddress"/>
				<element ref="addr:WorkAddress"/>
				<element ref="addr:OtherAddress"/>
			</sequence>
		</complexType>
	</element>

	<element name="businessContact">
		<complexType>
			<sequence>
				<element name="name" type="string"/>
				<element ref="addr:WorkAddress"/>
			</sequence>
		</complexType>
	</element>

	<element name="chairmanOfTheBoard">
		<complexType>
			<sequence>
				<element name="startDate" type="date"/>
				<element ref="addr:IndividualContact"/>
				<element ref="addr:BusinessContact"/>
			</sequence>
		</complexType>
	</element>	
</schema>				

The following guidelines are the preferred way to define business objects:

Modeling business objects