This interface provides enhancements to the ChangeSummary interface so that it can manage the Business Graph Change Summary header.
BOChangeSummary adds the functionality to the ChangeSummary interface enabling it to manage the Business Graph Change Summary header.
The ChangeSummary interface provides access to change history information for the data objects in a data graph. Change history covers any modifications made to the data graph starting from the point when logging was activated. If logging is no longer active, the log includes only changes that are made up to the point when logging was deactivated. Otherwise, it includes all changes up to the point at which the ChangeSummary is being interrogated.
This example shows how to use BOChangeSummary.
BOFactory factoryService = (BOFactory) new ServiceManager().locateService("com/ibm/websphere/bo/BOFactory"); BOChangeSummary changeSummaryService = (BOChangeSummary) new ServiceManager().locateService("com/ibm/websphere/bo/BOChangeSummary"); BODataObject dataObjectService = (BODataObject) new ServiceManager().locateService("com/ibm/websphere/bo/BODataObject"); DataObject productCategoryBG = factoryService.create("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG", "ProductCategoryBG"); DataObject productCategory = productCategoryBG.createDataObject("productCategory"); DataObject product1 = productCategory.createDataObject("product"); DataObject product2 = productCategory.createDataObject("product"); // Two mechanisms to find the change summary: // // 1. From the Business Graph. ChangeSummary changeSummary = (ChangeSummary) productCategoryBG.get("changeSummary"); // 2. From any data object using a convenience method. ChangeSummary changeSummary2 = dataObjectService.getChangeSummary(productCategory); changeSummary.beginLogging(); productCategory.setBoolean("domestic", false); product1.set("description", "NewValue"); product1.set("description", "NewValue2"); product2.set("description", "NewValue"); product2.set("description", "NewValue2"); changeSummary.endLogging(); List changedDataObjects = changeSummary.getChangedDataObjects(); Iterator i = changedDataObjects.iterator(); while (i.hasNext()) { DataObject dataObject = (DataObject) i.next(); if (changeSummary.isDeleted(dataObject)) { // ... continue; } if (changeSummary.isCreated(dataObject)) { // ... continue; } if (changeSummaryService.isUpdated(dataObject)) { // ... continue; } } // Annotate the product category object with an object changed event. changeSummaryService.setCreated(productCategory); // Annotate a property on the product category // object with a property changed event. changeSummaryService.addOldValue(productCategory, "ID", null, true); List changeSummarySettings = changeSummary.getOldValues(productCategory); Iterator i2 = changeSummarySettings.iterator(); while (i2.hasNext()) { ChangeSummary.Setting setting = (ChangeSummary.Setting) i2.next(); System.out.println("setting getProperty(): " + setting.getProperty()); System.out.println("setting getValue(): " + setting.getValue()); System.out.println("setting isSet(): " + setting.isSet()); } DataObject product3 = productCategory.createDataObject(“product”); //move product3 to location 0 in the list and //Make the appropriate changes to the changesummary. changeSummaryService.markListEntryMoved(product3, productCategory, “product”, 0); product3.set(“description”, “NewValue”); //Explicitly mark the list entry as created in the changesummary. changeSummaryService.markSimpleTypeCreated(“NewValue”, product, “description”); product3.set(“description”, “NewValue2”); changeSummaryService.markSimpleTypeCreated(“NewValue2”, product, “description”); //Delete the list entry and add a list change entry in the change summary. changeSummaryService.markSimpleTypeDeleted(“NewValue2”, product, “description”); product1.delete(); // The old container will return the productCategory object // since that is the old container for product1. changeSummaryService.getOldContainer(product1); // This will return the old containment property that is // what the property name is in the productCategory object. changeSummaryService.getOldContainmentProperty(product1);
Parent topic: Programming interfaces
Related reference
BOCopy
BODataObject
BOEquality
BOEventSummary
BOFactory
BOType
BOTypeMetadata
BOXMLDocument
BOXMLSerializer
Related information
Interface BOChangeSummary APIs
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)