BOFactory

This interface provides the capability to create a business graph or a business object.

Purpose

There are three typical models used for creating a business graph or a business object with the BOFactory interface:
  • Factory Create - Used to create a data object independent of an existing graph of data.
  • Containment Create (containment attach inferred) - Used to create a child data object of an existing data object.
  • Factory Create / Containment Attach - Uses a factory create mechanism to create a business object that is attached to a graph of business objects using the DataObject.setDataObject() method.

Examples

This example shows several different options for the Factory Create model.

BOFactory factoryService = (BOFactory) new 
		ServiceManager().locateService("com/ibm/websphere/bo/BOFactory");
BOType typeService = (BOType) new 
		ServiceManager().locateService("com/ibm/websphere/bo/BOType");

// 1. Use the business object Factory Create model with a target namespace
// and a complex type definition name.
DataObject productCategory1 = factoryService.create
		("http://www.scm.com/ProductCategoryTypes", "ProductCategory");

// 2. Use the business object Factory Create model with the type.
DataObject productCategory2 = factoryService.createByType(typeService.getType
		("http://www.scm.com/ProductCategoryTypes", "ProductCategory"));

// 3. Use the business object Factory Create model with the class.
DataObject productCategory3 = factoryService.createByClass
		(com.scm.pc.model.Product.class);
// Use the business graph Factory Create model with a target namespace
// and a complex type definition name.

// It also automatically creates the ChangeSummary and EventSummary headers.
DataObject productCategoryBG = factoryService.create
		("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG", 
		"ProductCategoryBG");

This is an example of the Containment Create model.

BOFactory factoryService = (BOFactory) new 
		ServiceManager().locateService("com/ibm/websphere/bo/BOFactory");

// Use the Factory Create model for the top level object.
DataObject productCategoryBG = factoryService.create
		("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG", 
		"ProductCategoryBG");

// Use the Containment Create model on the contained objects.
DataObject productCategory = productCategoryBG.createDataObject
		("productCategory");
DataObject product = productCategory.createDataObject("product");

This is an example of the Factory Create / Containment Attach model.

BOFactory factoryService = (BOFactory) new 
		ServiceManager().locateService("com/ibm/websphere/bo/BOFactory");
// Use the Factory Create model on the top level object.
DataObject productCategoryBG = factoryService.create
		("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG",
// Use the Factory Create model on what will eventually become a contained object.
DataObject productCategory = factoryService.create
		("http://www.scm.com/ProductCategoryTypes", "ProductCategory");
// Containment attach
productCategoryBG.setDataObject("productCategory", productCategory);

Parent topic: Programming interfaces

Related reference
BOChangeSummary
BOCopy
BODataObject
BOEquality
BOEventSummary
BOType
BOTypeMetadata
BOXMLDocument
BOXMLSerializer

Related information
Interface BOFactory APIs


Terms of use |

Last updated: Tue Sep 20 03:22:36 2005

Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)