BOCopy

Questa interfaccia semplifica la copia di un grafico di oggetti business o di un grafico business contenente un grafico di oggetti business.

Scopo

Sono presenti due forme di questa interfaccia. La prima viene utilizzata con un grafico di un oggetto business o un grafico business contenente un grafico di oggetti business. Il solo requisito è che si tratti di un oggetto di dati del servizio. L'altra viene utilizzata quando una serie secondaria di un grafico business di origine sta per essere copiato in un grafico business di destinazione.

business object framework definisce due diverse forme di copia. Il primo rappresenta una semplice copia del valore, con una variante profonda ed una superficiale. Quindi, è possibile copiare solo il livello superiore o il child. Questo meccanismo di copia può essere applicato sia ad un grafico degli oggetti business sia ad un grafico business contenente un grafico di oggetti business. La relativa implementazione non è correlata alla forma dell'oggetto di origine.

La seconda forma è intesa per un modello di utilizzo in cui una serie secondaria di grafico business di origine viene copiata in un grafico business di destinazione. Questa forma non solo copia l'oggetto business di origine (ed i relativi elementi in ordine decrescente se è una variante profonda), ma anche le relative informazioni su Modifica, Evento Intestazione verbo dell'oggetto/i business vengono copiate nel grafico business di destinazione.

Esempio

Di seguito viene riportato un esempio della forma copia/Superficiale.

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

// Utilizzare il modello Factory Create per l'oggetto di livello superiore.
DataObject productCategoryBG =
  factoryService.create("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG",
                           "ProductCategoryBG");

// Utilizzare il modello Containment Create sugli oggetti contenuti.
DataObject productCategory = productCategoryBG.createDataObject("productCategory");
DataObject product = productCategory.createDataObject("product");

// Copiare un grafico business (deep).
DataObject newProductCategoryBG = copyService.copy(productCategoryBG);

// Copiare un oggetto business (profondo).
DataObject newProductCategory = copyService.copy(productCategory);

// Copiare un oggetto business (superficiale).
DataObject newProductCategory2 = copyService.copyShallow(productCategory);

Di seguito viene riportato un esempio della forma copyIntro.

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

// Utilizzare il modello Factory Create per l'oggetto di livello superiore.
DataObject productCategoryBG =
  factoryService.create("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG",
                          "ProductCategoryBG");

// Utilizzare il modello Containment Create sugli oggetti contenuti.
DataObject productCategory = productCategoryBG.createDataObject("productCategory");
DataObject product = productCategory.createDataObject("product");

// Copiare un oggetto business child, con un contesto di grafico business,
// in un nuovo grafico business.
DataObject productBG =
  factoryService.create("http://www.scm.com/ProductTypes/ProductBG",
                          "ProductBG");
copyService.copyInto(product, productBG, "product");

Di seguito viene riportato un esempio della forma complessa copyIntro.

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

// Se si desidera eseguire una copia complessa da un grafico business di origine
// ad un grafico business di destinazione e conservare il contesto in cui:
//
// - Il grafico business di origine contiene:
//   - ProductCategoryBG productCategoryBG
//   - ProductCategory productCategory0 (productCategoryBG parent)
//   - ProductCategory productCategory1 (productCategory0 parent)
//   - ProductCategory productCategory2 (productCategory0 parent)
//   - Product product1 (productCategory1 parent)
//   - Product product2 (productCategory2 parent)
//
// - Il grafico business di destinazione contiene:
//   - ProductInventoryBG productInventoryBG
//   - ProductInventory productInventory (parent productInventoryBG)
//     - Property oldProduct (inizialmente vuoto)
//     - Property newProduct (inizialmente vuoto)
//
// Il seguente codice copia product1 dal grafico business di origine
// dell'oggetto business ProductInventory del grafico business
// di destinazione e product2 dalla proprietà newProduct del grafico business
// dell'oggetto business ProductInventory del grafico business
// di destinazione.

// Creare il grafico business di origine e il relativo grafico degli oggetti business.
DataObject productCategoryBG =
  factoryService.create("http://www.scm.com/ProductCategoryTypes/ProductCategoryBG",
                          "ProductCategoryBG");
DataObject productCategory0 = productCategoryBG.createDataObject("productCategory");
DataObject productCategory1 = productCategory0.createDataObject("productCategory");
DataObject productCategory2 = productCategory0.createDataObject("productCategory");
DataObject product1 = productCategory1.createDataObject("product");
DataObject product2 = productCategory2.createDataObject("product");

// Creare il grafico business di destinazione.
DataObject productInventoryBG =

factoryService.create("http://www.scm.com/ProductCategoryTypes/ProductInventoryBG",
                       "ProductInventoryBG");
DataObject productInventory =
    productInventoryBG.createDataObject("productInventory");

// Copiare product1 e product2 dal grafico business di origine,
// con il relativo contesto ChangeSummary/EventSummary associato,
// nelle proprietà newProduct e oldProduct dell'oggetto business
// ProductInventory del grafico. Utilizzare due meccanismi per illustrare il modo in cui è possibile utilizzare il percorso.
copyService.copyInto(product1, productInventory, "oldProduct");
DataObject oldProduct = productInventory.getDataObject("oldProduct");
oldProduct.delete();
copyService.copyInto(product1, productInventoryBG, "productInventory/oldProduct");
Riferimenti correlati
BOChangeSummary
BODataObject
BOEquality
BOEventSummary
BOFactory
BOType
BOTypeMetadata
BOXMLDocument
BOXMLSerializer
Informazioni correlate
API BOCopy interfaccia

Terms of use |

Last updated: Thu Apr 06 14:28:02 2006

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