Copying Objects

To copy an object in the Catalog, you call the copy method of the BIContext that contains the object.

When you copy an object, you specify whether to copy named objects that the copied object references. For example, if you copy a crosstab, and the crosstab uses a named query, then you can specify whether to copy the query. If you choose not to copy the query, then the reference to the query will be copied, but not the query itself.

Example: Copying a crosstab through the persistence service

The following code copies a crosstab ("SalesCrosstab") from a folder named "MyCrosstabs" to a folder named "SalesFolder." SalesFolder is in the root folder. This code does not change the name of the object. Essentially, it copies "Root/.../MyCrosstabs/SalesCrosstab" to "Root/SalesFolder/SalesCrosstab".


// ctxRoot is the initial context (root folder) // ctxMyCrosstabs is the PersistenceManager or MDFolder that contains // salesCrosstab BIContext ctxSalesFolder = null; try{    // get the folder to put the crosstab in    ctxSalesFolder = ctxRoot.lookup("SalesFolder");    // copy SalesCrosstab to the SalesFolder    // do not change name; do not copy referenced named objects    ctxMyCrosstabs.copy("SalesCrosstab", ctxSalesFolder, null, PSRConstants.NORMAL_COPY); } catch (NamingException ne){    ne.printStackTrace(); }