Using DFC 4213
Using DFC 4213
Using DFC 4213
Documentum
Applications
June 2002
Copyright © 2002
Documentum, Inc.
6801 Koll Center Parkway
Pleasanton, CA 94566
All Rights Reserved.
Documentum® Documentum RightSite®, Documentum Server®, Docbasic®,
Documentum DocPage Server®, Now You Know®, Documentum WorkSpace®,
Documentum SmartSpace®, Documentum ViewSpace®, AutoRender Pro™,
Docbase™, DocInput™, Docobject™, DocPage Builder™, Documentum 4i™,
Documentum Administrator™, Documentum CADLink™, Documentum
Commerce Server Integrators™, Documentum Application Server
Integrators™, Documentum Content Authentication Services™, Documentum
Content Personalization Services™, Documentum ContentCaster™,
Documentum Corrective Action Manager™, Documentum Desktop Client™,
Documentum Developer Studio™, Documentum DocControl Manager™,
Documentum DocLoader™, Documentum DocViewer™, Documentum
Dynamic Content Assembler™, Documentum eConnector for CAD™,
Documentum eConnector™ for IBM WebSphere® (IBM and WebSphere are
trademarks of IBM) Documentum eConnector for SAP™ (SAP is a trademark
of SAP AG), Documentum eConnector™, Documentum eConnector™ for BEA
Weblogic® (BEA is a registered trademark of BEA Systems Inc.) Documentum
eConnector™ for JDBC, Documentum eConnector™ for ATG Dynamo® (ATG
and Dynamo are registered trademarks of Art Technology Group),
Documentum eConnector™ for Lotus Notes® (Lotus Notes is a registered
trademark of Lotus Development Corporation) Documentum eContent
Server™, Documentum Engagement Services™, Document Engagement
Server™, Documentum ftpIntegrator™, Documentum Intranet Client™,
Documentum iTeam™, Documentum Reporting Gateway™, Documentum Site
Delivery Services™, Documentum Web Development Kit™, Documentum
Web Gear™, Documentum WebCache™, Documentum WebPublisher™,
GMPharma™, GXPharma™, GDPharma™, GSPharma™, Momentum™,
Virtual Document Manager™ (VDM), and Documentum Selfrepair™ are
trademarks or registered trademarks of Documentum, Inc. in the United States
and throughout the world. All other company and product names are used for
identification purposes only and may be trademarks of their respective owners.
Preface
1 Getting Started With DFC
What is DFC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Where is DFC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Programming with DFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Using DFC From Application Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Visual Basic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Establishing the Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Using Interface Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Syntax Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Creating DFC Client Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Java Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Visual Basic Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Using DFC Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Using the DFC Online Reference Documentation . . . . . . . . . . . . . . . . . . . . 1-11
Index
Intended Audience
This manual is intended for application developers. It assumes a knowledge
of object-oriented programming, Java, interfaces, and, in some places, the
Microsoft component object model (COM).
Sample Code
Some sample code in this manual is extracted and simplified from sample
classes that Documentum makes available to customers at
www.documentum.com/developer/samplecode.htm.
The sample classes provide complete working examples that you can run,
modify, and experiment with. They are not part of the product, and while we
have made every effort to ensure that they work properly, Documentum does
not support them.
The simplified examples focus on specific DFC tasks and omit code from the
sample classes that is not specific to DFC.
This manual does not cover workflows, or document lifecycles.
Chapter/Appendix Contents
Chapter 1, Getting Started What DFC is, where it resides, and how to start using
With DFC it.
Chapter 2, Working With How to perform basic operations like checkin and
Documents checkout. How to work with XML documents.
Chapter 7, Overview of the How DFC gives you an object oriented interface to
DFC Interface Hierarchy the Documentum object hierarchy.
Chapter 8, DFC and DMCL An explanation of DFC in terms of the methods that
previous Documentum client products use to access
server capabilities.
Convention Description
{} braces (curly Indicates an optional argument that can be repeated more than
brackets) once.
Two weeks after the release, we post a list of customer-reported bugs that
have been fixed in that release to the support area of www.documentum.com.
Product Documentation
What is DFC?
DFC is a set of Java classes and interfaces. It provides an object oriented
application programming interface (API) for accessing Documentum
functionality. You can use DFC in any of the following ways:
■ Access Documentum functionality from within one of your company’s
enterprise applications.
For example, your corporate purchasing application can retrieve a contract
from your Documentum system.
■ Customize or extend Documentum products like Desktop Client or WDK.
For example, you can modify the Desktop Client functionality to
implement one of your company’s business rules.
■ Write a method or procedure for eContent Server to execute as part of a
workflow or document lifecycle.
For example, the procedure that runs when you promote an XML
document might apply a transform to it and start a workflow to subject the
transformed document to a predefined business process.
The Documentum eContent Server Fundamentals manual provides a conceptual
explanation of the capabilities of eContent Server and how they work. DFC
provides a framework for accessing those capabilities. Using this framework
makes your code much more likely to survive future architectural changes in
the Documentum system.
The core of DFC is a set of Java classes, but it includes other elements as well:
■ A collection of DLLs to provide the DFC functionality.
■ A type library for accessing DFC via COM from Visual Basic or Visual
C++.
■ A set of C++ wrapper classes that hide many details of the DFC/COM
interface when you access DFC through the Microsoft foundation classes
(MFC) framework.
Where is DFC?
DFC runs on a JVM, which can be on:
■ The machine that runs eContent Server
For example, to execute a method as part of a workflow or document
lifecycle.
■ A middle-tier system
For example, to support WDK on an application server.
■ An end user’s computer
For example, to support Desktop Client.
The following fragment from a Java program that uses DFC contains three
parts. They implement the first three steps of the procedure.
Example IDfClient client = DfClient.getLocalClient();
The first part creates the client object, which encapsulates the Documentum
client software.
The second block creates and populates an object to hold login information
and uses it to manufacture an IDfSession object, which encapsulates a session
for this application program with the specified Docbase.
The third block of code creates and populates an IDfDocument object and
saves it in the Docbase. Notice that the newObject method of the session object
manufactures the object.
The newObject method returns an IDfPersistentObject object. The program
explicitly casts it to an IDfDocument object, then uses the document object’s
save method, a method that IDfDocument inherits from IDfPersistentObject.
COM does not support interface inheritance, so the Visual Basic and C++
versions of the above code explicitly cast the document object to a persistent
object before saving it.
Most DFC methods report errors by throwing a DfException object. Java code
like that in the above example normally appears within a try/catch/finally
block, with an error handler in the catch block. Visual Basic code uses the On
Error Goto statement to handle exceptions.
Note: When writing code that calls DFC , it is a good idea to include a finally
block to ensure that you can release storage and close open sessions.
Java
From Java, use the Java interface. Add the DFC class and interface files (for
example, ...Documentum\DFCre40\lib\dfc.jar) to your CLASSPATH. In your
Java source code, import the classes you wish to use.
Visual Basic
The DFC installer establishes the software environment to allow Visual Basic
to access DFC using COM. From a Visual Basic project, you need only
establish a reference to the DFC type library.
Example For example, in Java you can use the save method that an object of type
IDfSysObject inherits from IDfPersistentObject.
//Java
IDfSysObject sysObj = session.newObject("dm_document");
sysObj.setObjectName("test");
sysObj.save();
In Visual Basic, however, you must assign the IDfSysObject object to an
IDfPersistentObject object before calling its save method:
'Visual Basic
Dim sysObj As IDfSysObject
Dim perObj As IDfPersistentObject
C++
From C++, use COM directly, or, if you use MFC, you can use classes, called
wrapper classes, that Documentum provides to hide some of the complexities of
the COM interface. To use these classes with MFC, include the following files
in your Visual C++ project: DfClientX.h, DfClientX.cpp, dfc.h, and dfc_i.c
If you don’t use MFC or if you wish to write your own wrapper classes,
include only dfc.h and dfc_i.c.
Note: Interface inheritance requires a workaround if you access DFC from
C++, because the Microsoft Java virtual machine does not support COM
interface inheritance. See the example in the previous section.
Follow these rules for objects and pointers:
■ Always assign a DFC object to a new pointer.
First delete the old pointer, then create a new CDfSysObject, as in the
following C++ example:
//Get a DFC object
CDfSysObject sobj1 = session.getObject(id);
CDfSysObject *pSysObj = null;
■ A procedure that returns a DFC object should return a pointer to the object,
as demonstrated in the following Visual C++ example:
CDfSysObject *myFunction();
{
CDfSysObject sobj1 = session.getObject(id);
CDfSysObject *retval = new CDfSysObject (sobj1);
return retval;
}
Syntax Differences
COM and Java give you access to the same DFC classes and interfaces, but
COM datatypes differ slightly from Java datatypes. Table 1-1 shows the COM
equivalents of DFC datatypes.
Java (DFC datatype) Visual Basic C++ with MFC C++ directly to COM
(and Docbasic) wrapper classes
Java Example
Packages
DFC comprises a number of packages, that is, sets of related classes and
interfaces.
■ The names of DFC Java classes begin with Df (for example, DfWorkflow).
■ Names of interfaces begin with IDf (for example, IDfWorkflow).
The DFC interfaces form a hierarchy; some derive methods and constants
from others. Use the Tree link from the home page of the DFC online reference
(see “Using the DFC Online Reference Documentation” on page 1-11) to
examine the interface hierarchy. Click any interface to go to its definition.
Each interface inherits the methods and constants of the interfaces above it in
the hierarchy. For example, IDfPersistentObject has a save method.
IDfSysObject is a subclass of IDfPersistentObject, so it inherits the save
method (see “Persistent Objects” on page 7-12 and “SysObjects—Persistent
Objects With Content” on page 7-20).
In Java, you can call the save method of an object of type IDfSysobject.
COM does not support interface inheritance. Visual Basic or C++ programs
access DFC via COM and see DFC as a type library. The library is flat, that is, it
contains all of the interfaces but none of the inheritance information. In Visual
Basic, you must assign an object of type IDfSysObject to an object of type
IDfPersistent object before you can save it.
This chapter describes the way to use DFC to perform the most common
operations on documents. It contains the following main sections:
■ “Introduction to Documents” on page 2-1
■ “Introduction to Operations” on page 2-4
■ “Types of Operations” on page 2-5
■ “Basic Steps for Manipulating Documents” on page 2-5
■ “Operations for Manipulating Documents” on page 2-10
■ “Handling Document Manipulation Errors” on page 2-26
■ “Operations and Transactions” on page 2-28
Introduction to Documents
The Documentum eContent Server Fundamentals manual explains the
Documentum facilities for managing documents. This section provides a
concise summary of what you need to know to understand the remainder of
this chapter.
Documentum maintains a repository of objects that it classifies according to a
type hierarchy. For this discussion, SysObjects are at the top of the hierarchy
(see “SysObjects—Persistent Objects With Content” on page 7-20). A document
is a specific kind of SysObject. Its primary purpose is to help you manage
content.
Virtual Documents
folders and cabinets. A virtual document can have any number of components,
nested to any level. Documentum imposes no limit on the depth of nesting in
a virtual document.
Documentum uses two sets of terminology for virtual documents. In the first
set, a virtual document that contains a component is called the component’s
parent, and the component is called the virtual document’s child. Children, or
children of children to any depth, are called descendants.
Note: Descendants are sometimes called descendents in internal variables,
Javadoc comments, and registry keys.
The second set of terminology derives from graph theory. The virtual
document and all of its descendants are called nodes. The directed relationship
between a parent node and a child node is called an edge.
In both sets of terminology, the original virtual document is sometimes called
the root.
Documentum maintains more than one version of a document. A version tree is
an original document and all of its versions. Every version of the document
has a unique object ID, but every version has the same chronicle ID—the object
ID of the original document.
You can associate a particular version of a component with the virtual
document (this is called early binding) or you can associate the component’s
entire version tree with the virtual document. The latter allows you to select
which version to include at the time you assemble the document (this is called
late binding). Documentum provides an extremely flexible set of rules for
controlling the way it assembles documents.
An assembly is a snapshot of a virtual document. It consists of the set of
specific component versions that resulted from assembling the virtual
document according to a set of binding rules. To preserve it, you must attach it
to an existing SysObject—usually the virtual document. A SysObject can have
at most one attached assembly.
Documentum represents the components of virtual documents by containment
objects and the components of assemblies by assembly objects. An assembly
object refers to the SysObject to which the assembly is attached, and to the
virtual document from which the assembly came.
If an object appears more than once as a node in a virtual document or
assembly, each node has a separate associated containment or assembly
object. No object can appear as a descendant of itself in a virtual document.
You can version a virtual document and manage its versions just as you do a
simple document. Deleting a virtual document version also removes any
containment objects or assembly objects associated with that version.
When you copy a virtual document, the server can make a copy of each
component or it can create an internal reference or pointer to the source
component. It maintains information in the containment object about which of
these possibilities to choose. One option is to require the copy operation to
specify the choice.
Whether it copies a component or creates a reference, Documentum creates a
new containment object corresponding to that component.
Note: DFC allows you to process the root of a virtual document as an ordinary
document. For example, suppose that doc is an object of type IDfDocument
and also happens to be the root of a virtual document. If you tell DFC to check
doc out, it does not check out any of the descendants. If you wish to check out
the descendants, you must first execute an instruction like
IDfVirtualDocument vDoc =
doc.asVirtualDocument(CURRENT, “false”)
If you tell DFC to check vDoc out, it processes doc and all of its descendants.
XML Documents
Introduction to Operations
To manipulate documents in Documentum, you must understand operations.
Operations are like the document carriers you use to put small pieces of paper
through the feeder of a copying machine. Operations provide interfaces and a
processing environment to ensure that Documentum can handle a variety of
documents and collections of documents in a standard way. You obtain an
operation of the appropriate kind, place one or more documents into it, and
“run it through the machine,” that is, execute the operation.
The operations apply to objects of type IDfSysObject, not just the subtype
IDfDocument, but all of the examples in this chapter pertain only to
documents.
For example, to check out a document, take the following steps:
1. Obtain a checkout operation.
2. Add the document to the operation.
3. Execute the operation.
DFC carries out the behind-the-scenes tasks associated with checking out a
document. For a virtual document, for example, DFC adds all of its
components to the operation and ensures that links between them are still
valid when it stores the documents into the checkout directory on the file
system. It corrects filename conflicts, and it keeps a local record of which
documents it checked out. This is only a partial description of what DFC does
when you check out a document. Because of the number and complexity of
the underlying tasks, DFC wraps seemingly elementary document-
manipulation tasks in constructs called operations.
An object that implements the IDfClientX interface has methods for creating
operations. For this reason, we call it a factory for operations. Once you have
the factory object (say cX) and a sysobject representing the document (say
doc), the code for the checkout looks like this:
// Obtain a checkout operation
IDfCheckoutOperation checkout =
(IDfCheckoutOperation) cX.getOperation("Checkout");
In real code, you would check to see if the add method returns a null or the
execute method returns errors.
Types of Operations
There are operation types for many of the tasks you might wish to perform on
documents or, where appropriate, files or folders.
The names of the DFC interfaces associated with operations follow a naming
convention based on a root character string for each operation. In the
following list of tasks, the root string for naming the associated interfaces
appears in parentheses after the task.
■ Import into a Docbase (Import)
■ Export from a Docbase (Export)
■ Check into a Docbase (Checkin)
■ Check out of a Docbase (Checkout)
■ Cancel checkout (CancelCheckout)
■ Delete (Delete)
■ Copy from one Docbase location to another (Copy)
■ Move from one Docbase location to another (Move)
■ Validate an XML document against a DTD or Schema (Validation)
■ Transform an XML document using XSLT (XMLTransform)
Note: When you use the root string, you must reproduce the capitalization
exactly. Java is case sensitive, as is the factory method that creates operations.
a. Handle errors.
If it detects errors, the execute method returns the boolean value false. You
can use the operation’s inherited getErrors method to obtain a list of
failures (see the note about inherited methods on page page 2-7). For
details of how to process errors, see “Processing the Results” on page 2-9.
b. Perform tasks specific to the operation.
For example, after an import operation, you may wish to take note of all of
the new objects that the operation created in the repository. You might
wish to display or modify their properties.
This section discusses some issues and background for the steps of the general
procedure in the previous section, “Steps for Manipulating Documents” on
page 6.
Note: Each operation has a type (for example, IDfCheckinOperation) that
inherits most of its methods (in particular, its add and execute methods) from
IDfOperation. To use an operation from Visual Basic, you must assign the
operation to an object of type IDfOperation before using inherited methods.
See “Using Interface Inheritance” on page 1-5 for more details.
Different operations accept different parameters to control the way they carry
out their tasks. Some parameters are optional, some mandatory.
In some cases you can also use the getProperties method of IDfOperation to
obtain an IDfProperties object associated with the operation. The DFC
Javadocs explain how to use this object to fine tune operation behavior.
Once DFC has executed a step of the operation on all of the documents in the
operation, it cannot execute that step again. If you wish to perform the same
task again, you must construct a new operation to do so.
Normally, you use the operation’s execute method and let DFC proceed
through the execution steps. DFC provides a limited ability for you to execute
an operation in steps, so that you can perform special processing between
steps. Documentum does not recommend this approach, because the number
and identity of steps in an operation may change with future versions of DFC.
If you have a programming hurdle that you cannot get over any other way,
work with Documentum Technical Support or Consulting to design a
solution.
The examples use the term file to refer to files on the file system and the terms
document and folder to refer to Docbase documents and folders, as represented
by DFC objects of type IDfDocument and IDfFolder.
Importing
// Add the file and cast the node to the appropriate type
IDfImportNode node = (IDfImportNode) op.add(myFile);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
// Set the XML application
// See “Setting Parameters for the Operation” on page 2-7 for information
// about properties
node.getProperties().putString("XMLApplication", "CellPhoneCatalog");
Use the object’s setSession method to specify a Docbase session and the
object’s setDestinationFolder method to specify the Docbase cabinet or folder
into which the operation should import documents.
You must set the session before adding files to the operation.
You must set the destination folder, either on the operation or on each node.
You can add an IDfFile object or specify a file system path. You can also
specify whether to keep the file on the file system (the default choice) or delete
it after the operation is successful.
If you add a file system directory to the operation, DFC imports all files and
(recursively) directories in that directory.
You can also control version labels, object names, object types and formats of
the imported objects.
XML Processing
The line in the example under the comment “Set the XML application” tells
DFC not to determine the controlling XML application automatically but
instead to use the application called CellPhoneCatalog.
You can import XML files without doing XML processing. If node is an
IDfImportNode object, you can turn off XML processing on the node and all
its descendants by calling
node.setFormat(dm_document);
This also turns off content detection, so the operation will not recognize
embedded OLE objects.
Turning off these kinds of processing can shorten the time it takes DFC to
perform the operation.
Exporting
// Add the document and cast the node to the appropriate type
IDfExportNode node = (IDfExportNode) operation.add(docID);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
// Execute the operation
if (!op.execute()) { //See “Handling Document Manipulation Errors” on page 2-26 }
Checking Out
Checking In
// Add the document and cast the node to the appropriate type
IDfCheckinNode node = (IDfCheckinNode) op.add(doc);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
// Set the version and labels
op.setCheckinVersion(IDfCheckinOperation.NEXT_MINOR);
op.setVersionLabels("DRAFT,WIP");
After executing this code, you can obtain the ID of the document you just
checked in:
IDfId newId = node.getNewObjectId();
Note: to refer to the Windows files (for example, C:\myfile.doc), represent each
backslash by a double backslash (for example, the syntax C:\\myfile.doc). This
works in all Java environments.
To check in a document, you pass an object of type IDfSysObject, not the file on
the local file system, to the operation’s add method. DFC keeps track of which
local files correspond to which objects. If you specify a document that is not
checked out, DFC does not check it in. DFC does not treat this as an error.
You can specify checkin version, symbolic label, or alternate content file, and
you can direct DFC to preserve the local file.
If between checkout and checkin you remove a link between documents, DFC
adds the orphaned document to the checkin operation as a root node, but the
relationship between the documents no longer exists in the repository.
Cancelling Checkout
// Add the virtual document and cast the node to the appropriate type
IDfCancelCheckoutNode node = (IDfCancelCheckoutNode) op.add(vDoc);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
Copying
// Add the folder and cast the node to the appropriate type
IDfCopyNode node = (IDfCopyNode) op.add(srcFold);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
Moving
// Add the virtual document and cast the node to the appropriate type
IDfMoveNode node = (IDfMoveNode) op.add(vDoc);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
Follow the steps in “Steps for Manipulating Documents” on page 2-6. Options
for moving are essentially the same as for copying.
If the operation entails moving a checked out document, DFC leaves the
document unmodified and reports an error.
Deleting
// Add the document and cast the node to the appropriate type
IDfDeleteNode node = (IDfDeleteNode) op.add(doc);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
// Execute the operation
if (!op.execute()) { //See “Handling Document Manipulation Errors” on page 2-26 }
Example Delete all versions of all documents in a folder. Assume that fold is an object
of type IDfFolder and cX, an IDfClientX object, is a factory for operations.
//Assume that the following objects already exist:
IDfSession sess; // the Docbase session to use
IDfClientX cX; // a factory for operations
IDfFolder fold; // the folder
// Add the folder and cast the node to the appropriate type
IDfDeleteNode node = (IDfDeleteNode) op.add(fold);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
DFC uses a modified version of the Xerces XML parser, which it includes in
dfc.jar. See the DFC release notes for details about the specific version and the
Documentum modifications.
The execute method of an IDfValidateOperation object runs the parser in
validation mode to determine whether or not documents are well formed and
conform to the DTD or schema. If you do not specify it explicitly, DFC
determines the XML application automatically and looks in the application’s
folder in the repository for the DTD or schema.
If any argument or the DTD or schema is in the repository, the execute method
copies the content to the file system and performs the validation there.
If the parser detects errors, the operation’s execute method returns a value of
false, and you can use the operation’s getErrors method to obtain the error
information that the parser returns.
Example Validate an XML document, using C:\Temp for a working directory.
//Assume that the following objects already exist:
IDfSession sess; // the Docbase session to use
IDfDocument doc; // the root of the XML document
IDfClientX cX; // a factory for operations
// Add the document and cast the node to the appropriate type
IDfValidationNode node = (IDfValidationNode) op.add(vDoc);
if (node == null) { // See “Handling Document Manipulation Errors” on page 2-26 }
// Execute the operation
if (!op.execute()) { //See “Handling Document Manipulation Errors” on page 2-26 }
Example Validate the XML file C:\ContactInfo.xml, using the DTD associated with the
XML application called TelephoneBook.
//Assume that the following objects already exist:
IDfSession sess; // the Docbase session to use
IDfClientX cX; // a factory for operations
// Add the file and cast the node to the appropriate type
IDfOperationNode node =
op.add("C:\\ContactInfo.xml"); //See note on page 2-15
// Set the XML application (see “Setting Parameters for the Operation” on page 2-7)
node.getProperties().putString("XMLApplication", "TelephoneBook");
DFC uses a version of the Xalan XSL transformation (XSLT) engine, which it
includes in dfc.jar. See the DFC release notes for details about the specific
version and the Documentum modifications.
The execute method of an IDfXMLTransformOperation object uses the XSLT
engine and the specified XSL stylesheet to transform an XML file or
document. It places the output into a new document or attaches it to the
original document as a rendition. It can also output an object of type IDfFile,
or either of the Java types Writer or OutputStream.
Example Transform the file C:\PhoneInfo.xml into an HTML file
C:\PhoneDisplay.htm.
//Assume that the following objects already exist:
IDfSession sess; // the session to use
IDfClientX cX; // a factory for operations
IDfDocument style; // the XSL stylesheet in the repository
Example Transform the file C:\ContactInfo.xml into a new HTML document in the
repository, using the stylesheet C:\PublishContact.xsl.
//Assume that the following objects already exist:
IDfSession sess; // the Docbase session to use
IDfClientX cX; // a factory for operations
IDfID destId; // ID of the destination folder
The add method of any operation returns a null node if it cannot successfully
add the document, file or folder that you pass it as an argument. Test for a null
to detect and handle this failure. DFC does not report the reason for returning
a null.
After you execute an operation, you can use its getErrors method to retrieve
an IDfList object containing the errors. You must cast each to
IDfOperationError to read its error message.
Example Print errors returned by an operation.
//Assume that the following object already exists:
IDfOperation op; // the operation
if (!op.execute()) {
IDfList errors = op.getErrors();
int errorCount = errors.getCount();
if (errorCount > 0) {
for (int i = 0; i < errorCount; i++) {
IDfOperationError error = (IDfOperationError) errors.get(i);
String errorMsg = error.getMessage();
System.out.println(errorMsg);
} } }
After detecting that the operation’s execute method has returned errors, you
can use the operation’s abort method to undo as much of the operation as it
can. You cannot undo XML validation or transform operations, nor can you
restore deleted objects.
You can monitor the operation for progress and errors. Create a class that
implements the IDfOperationMonitor interface and install it by calling
IDfOperation.setOperationMonitor(). The operation periodically notifies the
operation monitor of its progress or of errors that it encounters.
Example Execute an operation, monitoring progress and checking for errors.
//Assume that the following object already exists:
IDfOperation op; // the operation
Observer // a class that implements IDfOperationMonitor
During execution, DFC calls the methods of your Observer instance to report
progress or errors. You can display this information to an end user. In each
case DFC expects a response that tells it whether or not to continue. You can
make this decision in the program or ask an end user to decide.
Your Observer class must implement the following methods:
■ progressReport
DFC supplies the percentage of completion of the operation and of its
current step. DFC expects a response that tells it whether to continue or to
abort the operation.
■ reportError
DFC passes an object of type IDfOperationError representing the error it
has encountered. It expects a response that tells it whether to continue or to
abort the operation.
■ getYesNoAnswer
This is the same as reportError, except that DFC gives you more choices.
DFC passes an object of type IDfOperationError representing the error it
has encountered. It expects a response of yes, no, or abort.
The Javadocs explain these methods and arguments in greater detail.
This chapter provides an index to the major DFC methods, organized by the
tasks the methods accomplish. The methods appear under the following
categories of Documentum-related activities:
■ “Communicating with the Server” on page 3-2
■ “Administering the System” on page 3-3
■ “Handling Objects” on page 3-5
■ “Retrieving and Setting Attributes” on page 3-10
■ “Searching the Docbase” on page 3-12
■ “Handling Content Objects” on page 3-13
■ “Printing Documents” on page 3-15
■ “Handling Virtual Documents” on page 3-16
■ “Handling Workflows” on page 3-18
■ “Handling Workflow Process Definitions” on page 3-20
■ “Handling Workflow Activity Definitions” on page 3-21
■ “Handling Workflow Work Items” on page 3-22
■ “Managing Inboxes” on page 3-23
IDfClient
IDfSession
End the transaction opened by the last beginTrans call, and discard (roll back,
undo) all of its changes.
void abortTrans()
Start a transaction.
void beginTrans()
Save changes made since the last beginTrans call (commit the change log to
the Docbase), and end the transaction (stop transaction logging).
void commitTrans()
Obtain a ticket that an application can substitute for the current user’s
password as an argument to the Connect method.
String getLoginTicket()
Return all error and informational messages at or above the specified severity
level for a session.
String getMessage(int severityLevel)
Specify the maximum number of rows an RDBMS call can return (for
performance tuning).
void setBatchHint(int batchSize)
IDfClient
IDfTypedObject getServerMapEx(
String docbaseName,
String protocol,
String hostName,
String portNumber)
IDfSession
Remove query caches, release memory for the server, or remove data
dictionary information.
void flush(
String flushType,
String cacheKey)
int priority,
boolean sendMail,
IDfTime dueDate)
Return a list of subconnections and the Docbases to which they are connected.
apiGet("dumpconnection[,session]")
Return the subconnections and the Docbases associated with them for a
specified session.
apiGet("listconnection,session")
Handling Objects
The following methods manipulate objects.
IDfSession
Create a new persistent object of the specified type, optionally specifying the
fully qualified name of the DFC-derived subclass of IDfPersistentObject.
IDfPersistentObject newObject(String typeName)
IDfPersistentObject newObjectWithType(
String typeName,
String className)
IDfPersistentObject
Fetch the object from the Docbase again (discard unsaved changes).
void revert()
IDfSysObject
Simultaneously check the object out and create a new version branch.
IDfId branch(String versionLabel)
Create and save a new version of the checked-out object, and unlock the
previous version.
IDfId checkin(
boolean fRetainLock,
String versionLabels)
IDfId checkinEx(
boolean fRetainLock,
String versionLabels,
String oldCompoundArchValue,
String oldSpecialAppValue,
String newCompoundArchValue,
String newSpecialAppValue)
Create and save a new version of the checked-out object and unlock the
previous version. This method is intended for use internally and by user-
written applications. It differs from checkin by providing arguments that set
the a_special_app and a_compound_architecture attributes.
checkinApp()
Obtain a copy of the object from the repository, and lock it.
void checkout()
IDfId checkoutEx(
String versionLabel,
String compoundArchValue,
String specialAppValue)
Obtain the ID of the remote object pointed to by the object. This only applies if
the object is a local mirror object.
IDfId getRemoteId()
Promote the object to the specified state of its lifecycle, optionally overriding
entry criteria. Optionally, test the entry criteria without promoting the object.
void promote(
String state,
boolean override,
boolean fTestOnly)
Remove all old versions of the object, optionally keeping labeled versions.
void prune(boolean keepSLabel)
Refresh attribute values from the remote object pointed to by the object. This
applies only if the object is a local mirror object.
void refreshReference()
Move the object from a suspended state to a normal state in its lifecycle.
void resume(
String state,
boolean toBase,
boolean override,
boolean fTestOnly)
Remove all access control entries from this object for the specified user or
group.
void revoke(
String accessorName,
String extendedPermission)
Save the object, overwriting the copy in the Docbase. Keep the lock, and don’t
change the version.
void saveLock()
Move the object from the specified lifecycle state to the associated exception
state.
void suspend(
String state,
boolean override,
boolean fTestOnly)
Specify which ACL to use for the object (folder, user, type, or none).
void useACL(String aclType)
IDfAcl
IDfSession
IDfTypedObject
The declaration of the value parameter for each of these methods is:
boolean value, double value, Id value, int value
String value, IDfTime value, IDfValue value
Return the index of the first occurrence of the specified value in the specified
repeating attribute.
int findType(
String attrName,
type value)
Return all the values of the specified repeating attribute, concatenated into a
single string.
String getAllRepeatingStrings(
String attrName,
String separator)
Return the value at the specified index in the specified repeating attribute.
type getRepeatingType(
String attrName,
int valueIndex)
Return the number of values the specified attribute has (always 1 for a single-
valued attribute).
int getValueCount(String attrName)
Remove the value at the specified index from the specified repeating attribute.
void remove(
String attrName,
int valueIndex)
Remove all values with index greater than or equal to the specified index from
the specified repeating attribute.
void truncate(
String attrName,
int valueIndex)
IDfQuery
IDfSession
Return the object (or its ID) that satisfies the search condition, which is the
portion of a SELECT statement that begins with the keyword FROM.
IDfPersistentObject getObjectByQualification
(String qualification)
IDfId getIdByQualification(String qualification)
Return the collection that resulted from the most recently executed query.
IDfCollection getLastCollection()
IDfCollection
IDfSysObject
Add a rendition to the document, using the specified format and the contents
of the specified file.
void addRendition(
String fileName,
String formatName)
void addRenditionEx(
String fileName,
String formatName,
int pageNumber,
String storageName,
boolean atomic)
Append information in working memory as the last content file for the
document (used in applications to append content to multipaged documents).
void appendContent(ByteArrayOutputStream content)
Fetch the specified content file from the Docbase, and return the file path at
which the system places it.
String getFile(String fileName)
String getFileEx(
String fileName,
String formatName,
int pageNumber,
boolean getResource)
Insert content from a byte array stream into the document at the specified
page. (Used by applications to insert data into multipaged documents.)
void insertContent(
ByteArrayOutputStream content,
int pageNumber)
Remove the specified rendition from the document, optionally saving the
changes to the Docbase as part of the operation.
void removeRendition(String formatName)
void removeRenditionEx(
String formatName,
int pageNumber,
boolean atomic)
Set data in working memory as new content or use it to replace content. (Used
in applications to set the content of an object.)
boolean setContent(ByteArrayOutputStream content)
Set the next position (byte range) for reading a content collection.
apiExec("seek,session,collection,
position[,direction]")
Printing Documents
The following methods perform print operations.
IDfSysObject
int startingContentPage,
int endingContentPage)
IDfSysObject
Insert the specified component at the specified position among the virtual
document’s components.
IDfId insertPart(
IDfId componentID,
String versionLabel,
IDfId beforeContainmentId,
double orderNo,
boolean orderNoFlag,
boolean useNodeVerLabel,
boolean followAssembly,
int copyChild)
Force the server to treat the object as a virtual document, even though it may
have no components.
void setIsVirtualDocument(boolean treatAsVirtual )
IDfVirtualDocument
Handling Workflows
Most of the following methods manage running workflows.
IDfSession
IDfWorkflow
IDfProcess
Create a link to connect the specified output port of the specified source
activity to the specified input port of the specified destination activity (all
ports and activities are already part of the process definition).
void addLink(
String linkName,
String linkSrcActivity,
String linkSrcPortName,
String linkDestActivity,
String linkDstPortName)
Install the validated process definition and, if necessary, its activities. Specify
whether to resume or to abort workflows that are based on this definition.
void install(
boolean installActivity,
boolean resume)
IDfActivity
Add the specified package to the specified port of the activity definition.
void addPackageInfo(
String portName,
String packageName,
String packageType,
IDfId packageId,
String packageLabel,
String packageOperation)
Remove the specified package from the specified port of the activity
definition.
void removePackageInfo(
String portName,
String packageName)
IDfWorkitem
Designate a list of additional users or groups to receive the work item when
the performer finishes it.
void repeat(IDfList list)
Managing Inboxes
The following methods manage inboxes (user queues).
IDfSession
IDfSysObject
Register the user to receive notification if the specified event happens to the
object.
void registerEvent(
String message,
String event,
int priority,
boolean sendMail)
This chapter describes the way to work with DFC sessions and a Docbase
map. The examples in it are based on the classes DfExSession and
DfExDocbaseMap, which are available in Java and Visual Basic versions from
www.documentum.com/developer/samplecode.htm.
The chapter contains the following main sections:
■ “About Sessions” on page 4-1
■ “Connecting and Disconnecting” on page 4-2
■ “Using a Docbase Map” on page 4-6
About Sessions
In order to use DFC, you must provide login information and establish a DFC
session with a Documentum server. The following section, “Connecting and
Disconnecting” on page 4-2, shows how to do this.
The DFC client (see “Creating DFC Client Objects” on page 1-8) issues server
commands and accesses data via the session. Table 4-1 describes the types of
DFC sessions.
Shared Sessions
If you ask for a shared session, DFC returns an existing one or creates a new
one for you. Using shared sessions decreases the number of sessions you must
connect and disconnect yourself.
To establish a shared session, you must specify a session key. For security
reasons, there is no DFC method to retrieve this key, so you must save it if you
need to use it again. To use a specific shared session, you must know its key.
Adopted Sessions
connectToDocbase in Java
//Connect to the Docbase.
IDfSession connectToDocbase() throws IOException {
IDfSession sess = null;
String docbase = null;
try {
//Get local client object that calls into DMCL40 to connect
//to Documentum servers - this is the entrance to DFC
IDfClient client = DfClient.getLocalClient();
disconnectFromDocbase in Java
boolean disconnectFromDocbase(IDfSession sess) {
boolean retVal = false;
try {
if(sess.isConnected()) { //If session is connected
sess.disconnect(); // Disconnect
if(!sess.isConnected()) { // If disconnect succeeded
retVal = true; // Report success
} else { // If disconnect failed
//ERROR ACTION // Take error action
}
} else { //If session not connected
//ERROR ACTION // Take error action
}
} catch(DfException dfe) {
System.out.println("\n" + dfe.toString());
}
return retVal;
}
displaySessionInfo in Java
//Display details about the active session.
void displaySessionInfo(IDfSession s) {
try {
System.out.println("\nDocbase : " + s.getDocbaseName());
System.out.println("Srvr Vers : " + s.getServerVersion());
System.out.println("DBMS : " + s.getDBMSName());
System.out.println("Owner : " + s.getDocbaseOwnerName());
System.out.println("Sess Id : " + s.getSessionId());
System.out.println("DMCL Sess Id: " + s.getDMCLSessionId());
System.out.println("Docbase Id : " + s.getDocbaseId());
System.out.println("Scope : " + s.getDocbaseScope());
System.out.println("User : " + s.getLoginUserName());
System.out.println("Login Ticket: " + s.getLoginTicket());
System.out.println("Security : " + s.getSecurityMode());
} catch(DfException dfe) {
System.out.println("\n" + dfe.toString());
} }
disconnectFromDocbase = retVal
Exit Function
ErrorHandler:
writeDiagnostic Err.Description, False
End Function
displayDocbaseInfo in Java
void displayDocbaseInfo(IDfDocbaseMap m, int idx){
try {
System.out.println("Docbase: " + m.getDocbaseName(idx));
System.out.println("Descrip: " + m.getDocbaseDescription(idx));
System.out.println("Id : " + m.getDocbaseId(idx));
System.out.println("Server : " + m.getServerVersion(idx));
} catch (DfException dfe) {
System.out.println("\n" + dfe.toString());
} }
DfExMainForm.cbxDocbase.Text = docbaseName
Set sess = exSess.connectToDocbase(sess) 'Connect to Docbase
If Not sess Is Nothing Then
writeDiagnostic "Connected to: " +
docbaseName, False
exSess.displaySessionInfo sess 'Display session details
exSess.disconnectFromDocbase sess 'Disconnect
End If
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
This chapter describes the way to use DFC to create and perform queries and
to process the results. The examples in it are based on the class
DfExSimpleQuery, which is available in Java and Visual Basic versions on
www.documentum.com/developer/samplecode.htm.
You can find out more about queries by examining the DfExFullTextQuery
class. This manual does not contain examples from that class.
Queries
DFC provides an easy-to-use mechanism for querying the Docbase and
processing the query results. You use a query object to submit the query, and
receive the results in a collection object.
If you don’t know that the attribute is a string, you can find out what it is by
calling
attr.getDataType()
and changing the second line above according to what getDataType returns.
8. Close the IDfCollection and IDfSession objects.
IDfQuery has no close method, because a query object is not tied to a session.
Note: the number of sessions available to an application is limited. If you do
not close them, you make it more likely that you will exhaust the supply.
Be careful to close open collections and sessions even in the event of an
exception. The best place for a Java program to call close is in a finally block,
because Java executes a finally block whether there is an exception or not.
IDfQuery
An IDfQuery object holds a DQL query string and allows you to perform that
query in any session. You pass the session and the query to the execute
method, and it returns results as an IDfCollection object.
IDfCollection
ErrorHandler:
writeDiagnostic Err.Description, False
End Function
col.Close
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
execQuery in Java
IDfCollection execQuery(IDfSession sess, String queryString)
{
IDfCollection col = null; //For the result
try {
IDfQuery q = new DfQuery(); //Create query object
q.setDQL(queryString); //Give it the query
col = q.execute(sess, DfQuery.DF_READ_QUERY); //Execute synchronously
} catch (DfException dfe) {
System.out.println("\n" + dfe.toString());
}
return col;
}
displayResults in Java
//Step through a collection and display results
void displayResults(IDfCollection col) throws IOException
{
try {
int resItems = 1; //Count rows
while (col.next()) {
System.out.println("\nResult row: " + resItems++); //Display row num
for (int i = 0; i < col.getAttrCount(); i++) { //For attribute
IDfAttr attr = col.getAttr(i);
System.out.print("\t" + attr.getName() + ": "); // Display name
if (attr.getDataType() == attr.DM_BOOLEAN) { // Display value
System.out.println( // using method
col.getBoolean(attr.getName())); // for its type
} else if (attr.getDataType() == attr.DM_DOUBLE) {
System.out.println(
col.getDouble(attr.getName()));
} else if (attr.getDataType() == attr.DM_ID) {
System.out.println(
col.getId(attr.getName()).toString());
} else if (attr.getDataType() == attr.DM_INTEGER) {
System.out.println(
col.getInt(attr.getName()));
} else if (attr.getDataType() == attr.DM_STRING) {
System.out.println(
col.getString(attr.getName()));
} else if (attr.getDataType() == attr.DM_TIME) {
System.out.println(
col.getTime(attr.getName()).toString());
} else { //Unknown type
//ERROR ACTION // Handle error
} } }
col.close(); //Close collection
} catch (DfException dfe) {
System.out.println("\n" + dfe.toString());
} }
This chapter describes the way to work with Documentum features that help
you automate your business rules. The examples in it are based on the classes
DfExSimpleValidation andDfExACL, which are available in Java and Visual
Basic versions at www.documentum.com/developer/samplecode.htm.
Documentum provides other ways to automate business rules (for example
workflows and document lifecycles). The Documentum eContent Server
Fundamentals manual describes those facilities. This manual does not contain
examples of using DFC to work with workflows and document lifecycles.
This chapter contains the following main sections:
■ “Checking Objects Against Validation Rules” on page 6-1
■ “Changing Permissions” on page 6-2
■ “Using Private ACLs” on page 6-5
■ “ACL Utility Methods” on page 6-7
validate in Java
// Perform validation
void validate(
IDfSession sess, //Session
String objIdStr, //ID of the object to validate
String attrName) //Attribute to validate (null or "" = perform both
// object level and attribute level validation)
throws DfValidationException, IOException
{
try {
IDfId objId = new DfId(objIdStr);
IDfPersistentObject perObj = sess.getObject(objId);
Changing Permissions
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
changeBasicPermissions in Java
//Change and display object permissions
void changeBasicPermissions(
IDfSession sess, //Session
changeExtendedPermissions in Java
//Change and display extended object permissions
void changeExtendedPermissions(
IDfSession sess, //Session
String objId, //ID of obj for which to change permissions
String anotherUser) //A user to whom to assign permissions
throws IOException
{
try {
//Use ID string to obtain the ID, then the object
IDfId sysObjId = new DfId(objId);
IDfSysObject sysObj = (IDfSysObject)sess.getObject(sysObjId);
Exit Sub
ErrorHandler:
privateACLs in Java
//Create a private ACL and apply it to an object
void privateACLs(
IDfSession sess, //Session
String objId //Object with which to associate the ACL
String permission, //Permission to grant to world and owner
String extPermission, //Ext permissions to grant world and owner
String aclName //Name of ACL to create
) throws IOException {
try {
//Use ID string to obtain the ID, then the object
IDfId sysObjId = new DfId(objId);
IDfSysObject sysObj = (IDfSysObject)sess.getObject(sysObjId);
Exit Function
ErrorHandler:
writeDiagnostic Err.Description, False
End Function
writeDiagnostic
" ACL Name: " +
sysObj.getACLName, False 'ACL name
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
writeDiagnostic
" ACL Name: " + sysObj.getACLName, False 'ACL name
Exit Sub
ErrorHandler:
writeDiagnostic Err.Description, False
End Sub
permissionToString in Java
//Convert permission code to name
String permissionToString(String permission)
{
String retVal = null;
return retVal;
}
extendedPermissionToString in Java
//Convert extended permission code to name
String extendedPermissionToString(String permission)
{
String retVal = null;
return retVal;
}
displayBasicPermissions in Java
//Display object permissions
void displayBasicPermissions(IDfSysObject sysObj)
{
try {
System.out.println(
"\tACL Name: " + //ACL name
sysObj.getACLName());
displayExtendedPermissions in Java
//Display the object's extended permissions
void displayExtendedPermissions(IDfSysObject sysObj)
{
try {
System.out.println(
"\tACL Name: " + sysObj.getACLName()); //ACL name
This chapter moves through the DFC interfaces that derive from the
Documentum object type hierarchy, starting from the top. It contains the
following major sections:
■ “Documentum Object Hierarchy” on page 7-1
■ “Typed Objects” on page 7-8
■ “Persistent Objects” on page 7-12
■ “Persistent Objects Without Associated Content” on page 7-16
■ “SysObjects—Persistent Objects With Content” on page 7-20
■ “IDfSession” on page 7-22
■ “IDfClient” on page 7-27
■ “Common Package” on page 7-30
Attributes are fields that are part of the object. The values in these fields
describe the object. For example, two of the attributes for a document object
are title and subject. When you create a document, you provide a title and
subject that are specific to that document. Attributes are either single-valued
or multi-valued (repeating). Some are read only and some can be read or
written.
Using DFC, you operate on objects through interfaces that represent the
object. Because the Documentum model and DFC are both object-oriented, a
large part of the DFC structure corresponds directly to the Documentum
object type structure. DFC provides interfaces corresponding to most system-
defined object types. The interface has separate set and get methods for each
of the type’s attributes, and it has methods that pertain to objects of that type.
You read or change the attribute values via the get and set methods, and you
operate on the object through the interface’s methods.
By the conventions of object-oriented programming, a method without
arguments performs the corresponding operation on its associated object. For
example, the statement
document.save();
appears in the example on page 1-4. It tells the document object to apply its
save method to itself, that is, to save the document in the Docbase. Methods
that operate on other objects take references to those objects as arguments.
Persistence
Most objects the server manipulates are persistent, that is, they reside in the
Docbase and persist across sessions. A document you create and save in one
session is still there in another session on another day.
Some objects are not persistent, that is, they do not reside in the Docbase. The
server creates them as needed at runtime. For example, collection objects and
query result objects, which return the results of DQL statements, are not
persistent. When the server executes a DQL query it creates a collection object
to contain the results of the query. It creates a query result object for each row
that the underlying database returns for the underlying SELECT statement,
and it associates the query result objects with the collection object. When you
close a collection, the server destroys the collection object and the query result
objects.
IDfTypedObject
Non-Persistent Type
IDfDocument IDfFolder
dm_document dm_folder
<None>
dm_cabinet
In Figure 7-2 on page 7-6, you can see how the interfaces that derive from the
Documentum hierarchy fit into the total DFC interface hierarchy.
IDfTypedObject
IDfPersistentObject
IDfACL
IDfAliasSet
IDfAssembly
IDfContainment
IDfFormat
IDfGroup
IDfPackage
IDfQueueItem
IDfRelation
IDfRelationType
IDfActivity
IDfSysObject
IDfDocument
IDfType
IDfFolder
IDfUser
IDfProcess
IDfWorkItem
IDfRouter
IDfWorkflow
IDfCollection
IDfDocbaseMap
IDfOperation
IDfCancelCheckoutOperation
IDfCheckinOperation
IDfCheckoutOperation
IDfCopyOperation
IDfDeleteOperation
IDfExportOperation
IDfImportOperation
IDfMoveOperation
IDfOperationNode
IDfCancelCheckoutNode
IDfCheckinNode
IDfCheckoutNode
IDfCopyNode
IDfDeleteNode
IDfExportNode
IDfImportNode
IDfMoveNode
IDfClientRegistryObject
IDfCheckedOutObject
IDfLocalObject
IDfViewedObject
DFC interfaces that are not in the above diagrams are not part of the interface
hierarchy. They do not derive from other DFC interfaces, and vice versa.
Typed Objects
The IDfTypedObject interface provides the basis for both persistent and non-
persistent types. Here are the main facts about typed objects:
■ They have attributes (properties) that you can retrieve and set.
■ In almost all cases, you obtain them directly or indirectly through a DFC
session; therefore they have a reference to the session that created them.
■ A unique object ID identifies them.
The ID of a persistent object uniquely identifies the object in the Docbase. The
ID of a non-persistent object, such as a collection or a Docbase map, identifies
the object only for the session that creates it.
The DFC online reference contains signatures of the methods of DFC
interfaces (see “Using the DFC Online Reference Documentation” on page
1-11). This section describes the general categories of methods of the
IdfTypedObject interface. IDfTypedObject is the base object for most DFC
objects.
Typed objects have IDs, and they hold references to the session that created
them. The IDfTypedObject methods getSession and getObjectId return this
information.
void setRepeatingBoolean(
String attrName, int index, boolean value)
void setRepeatingDouble(
String attrName, int index, double value)
void setRepeatingId(
String attrName, int index, IDfId value)
void setRepeatingInt(
String attrName, int index, int value)
void setRepeatingString(
String attrName, int index, String value)
void setRepeatingTime(
String attrName, int index, IDfTime value)
void setRepeatingValue(
String attrName, int index, IDfValue value)
You can use single-value attribute methods to set/get repeating attributes and
repeating-attribute methods to get/set single valued attributes. Single-valued
methods always operate on the repeating attribute value at index 0. To use a
repeating-attribute method for a single-valued attribute, the index argument
must be 0.
The call
getAllRepeatingStrings(String attrName, String separator)
returns all values of a repeating attribute as a single string with values
delimited by separator, or by a comma if separator is null.
For example, given the authors mentioned above,
getAllRepeatingStrings("authors", null)
returns the string
Sleepy,Dopey,Happy,Sneezy,Grumpy,Doc,Bashful
Attribute Information
Persistent Objects
Persistent objects are at the second level of the DFC interface hierarchy. They
are typed objects that reside in the Docbase. The IDfPersistentObject interface
inherits from the IDfTypedObject interface, and hence, IDfPersistentObject
has all the methods of IDfTypedObject. In addition IDfPeristentObject has the
following sets of methods.
Every object in the Docbase has an i_vstamp attribute, which contains the
number of committed transactions that have changed the object. This value is
used for versioning, as part of the locking mechanism, to ensure that one user
does not overwrite the changes made by another. The getVStamp method
returns this value.
You can replicate Documentum objects, that is, have them appear in more
than one Docbase. The isReplica method returns True if the object is a local
replica of an object in a remote Docbase.
Every object in the Docbase has an object type. DFC exposes the type through
the IDfType interface. To obtain an object’s type information, call the getType
method.
Audit Trail
Auditing enables you to record information about system events and preserve
information in an audit trail, which you can then use to track events and
generate reports. You choose which events to monitor, and the audit system
logs pertinent data, including the time of the event. To support this process,
IDfPersistentObject has the signoff method, which creates an audit trail entry
of signoff information for an object.
Validation Methods
The following method returns an IDfValidator object for the persistent object:
IDfValidator getValidator()
You can also obtain an IDfValidator interface for an IDfType object:
IDfValidator getValidator(IDfID policy, String state)
The IDfValidator interface provides a variety of utilities:
void validateAll(IDfProperties attrValues, boolean
modifiedAttrsOnly)
void validateAllAttrRules(IDfProperties attrValues, boolean
modifiedAttrsOnly)
void validateAllObjRules(IDfProperties attrValues)
void validateAttrRules(String attrName, IDfList values,
IDfProperties depAttrValues)
IDfId getPolicyID()
String getStateName()
IDfACL
IDfACL provides the functionality associated with the server type dm_acl. An
access control list (ACL), also called a permission set, is the usual server
mechanism for controlling who has access to an object. If the Docbase security
mode is set to acl, then every sysobject (that is, every object of type
dm_sysobject or of a type that derives from dm_sysobject) has an associated
ACL that specifies which users can operate on an object and what they can do.
The Documentum eContent Server Fundamentals manual discusses the two kinds
of permissions: basic and extended. Chapter 6, Automating Business Rules
with DFC contains an extended example of how to use DFC to work with
these permissions.
IDfFormat
IDfType
Basic Attributes
The getName method returns the type’s name—a string like dm_format or
dm_document.
The getDescription method returns the type’s user-friendly name from the
data dictionary. The user interface uses the user-friendly name. For example, a
search dialog box may display the name Format rather than dm_format.
Most types derive from other types. Firms that deploy Documentum usually
create several layers of new types to meet their specific needs. IDfType
provides the following methods to test whether the type derives from another
type:
String getSuperName()
IDfType getSuperType()
boolean isSubTypeOf(String typeName)
The getSuperName method returns the name of the type’s parent type, or null
if the type has no parent type. For example, if you hold an IDfType reference
to the dm_document type, getSuperName returns dm_sysobject.
The method getSuperType returns an IDfType reference to the supertype.
You can call isSubTypeOf to test whether a type is a subtype of another type.
For example, if you hold an IDfType reference to the dm_document type,
isSubTypeOf("dm_sysobject") returns True. By convention, a type is
not a subtype of itself, so isSubTypeOf("dm_document") returns False.
Type Information
Programs typically make use of IDfType objects to get information about the
attributes of that type. The type dm_type contains several repeating attributes
that describe the attributes of the type. The DFC methods for most of these
attributes come in two varieties. One takes an index into the array of repeating
attributes; the other takes a string specifying the attribute name. The indexed
methods are slightly more efficient.
The following IDfType methods return type information:
int getTypeAttrCount()
String getTypeAttrNameAt(int index)
int getTypeAttrDataTypeAt(int index)
int getTypeAttrDataType(String attrName)
boolean isTypeAttrRepeatingAt(int index)
boolean isTypeAttrRepeating(String attrName)
int getTypeAttrLengthAt(int index)
int getTypeAttrLength(String attrName)
int findTypeAttrIndex(String attrName)
String getTypeAttrDescriptionAt(int index)
String getTypeAttrDescription(String attrName)
The getTypeAttrCount method returns the number of attributes the type has.
The method getTypeAttrNameAt returns the attribute name at the specified
index. To find an attribute’s index, call findTypeAttrIndex. The indexes start at
zero. The above get type attribute methods return the type of the attribute.
This is one of the following values:
IDfType.DF_BOOLEAN
IDfType.DF_INTEGER
IDfType.DF_STRING
IDfType.DF_ID
IDfType.DF_TIME
IDfType.DF_DOUBLE
IDfType.DF_UNDEFINED
They return IDfType.DF_UNDEFINED only in unusual circumstances.
The isRepeating methods indicate whether the attribute is repeating.
For attributes whose type is DF_STRING, the getTypeAttrLengthAt and
getTypeAttrLengthAt methods return the maximum character length of any
string that can be stored in that attribute. For attributes of other types, these
methods return 0.
The get type attribute description methods return attribute descriptions from
the data dictionary. This information does not reside in the dm_type object.
Recall that IDfType derives from IDfPersistentObject, which, in turn, derives
from IDfTypedObject. IDfTypedObject has the following methods:
Enumeration enumAttrs()
int findAttrIndex(String attrName)
IDfAttr getAttr(int index)
int getAttrCount()
int getAttrDataType(String attrName)
boolean hasAttr(String attrName)
isAttrRepeating(String attrName)
Developers often find this confusing. Calling these methods on an IDfType
object returns information about the attributes of the type dm_type, not the
type that the IDfType object describes.
For example, suppose that the IDfType object named doctype describes the
type dm_document. The method doctype.getAttrCount returns 15, even
though dm_document has almost 70 attributes. The reason is that
getAttrCount returns the number of attributes that dm_type has, not the
number of attributes that dm_document has.
To get the number attributes for dm_document, call
doctype.getTypeAttrCount
Similarly, if you call doctype.getAttrDataType("object_name"), DFC throws an
exception, because dm_type does not have an attribute called "object_name".
To discover the type of the dm_document attribute object_name, call
getTypeAttrDataType("object_name").
All IDfType methods that return attribute information about the type that the
IDfType object describes have method names that begin with getTypeAttr. The
methods inherited from IDfTypedObject return information about dm_type.
Types that need any of these capabilities derive from dm_sysobject. Since the
primary focus of Docbases is content, most objects in the Docbase are either
SysObjects or objects whose type derives from dm_sysobject.
IDfSession
All interaction with a Docbase occurs in a session, that is, using an IDfSession
object. In broad terms, a session:
■ Uses the underlying DMCL library to maintain a connection to a Docbase.
■ Maintains the state of the interaction between an application and the
Docbase.
■ Caches information to increase performance.
A session keeps track of the objects you fetch and change. It provides
explicit and implicit transaction support. The underlying DMCL does most
of this, but DFC also caches some information and maintains some state.
■ Provides service methods for creating and fetching objects, performing
administrative tasks, and obtaining session information.
An IDfSession provides the following categories of functionality.
Provide Information
The following methods ask for information that the session has access to:
IDfClient getClient();
IDfLoginInfo getLoginInfo()
String getDBMSName()
String getDMCLSessionId()
String getDocbaseId()
String getDocbaseName()
String getDocbaseOwnerName()
String getLoginUserName()
String getSecurityMode()
String getServerVersion()
String getSessionId()
boolean isACLDocbase()
boolean isAdopted()
boolean isConnected()
boolean isRemote()
boolean isShared()
Note: be careful not to write getRDBMSName for getDBMSName. The
version without the “R”is correct.
Developers sometimes ask why they can’t create a new SysObject as follows:
obj = new DfSysObject;
The short answer is that all persistent objects reside in the Docbase, so you can
create or fetch them only through a session. “Programming with DFC” on
page 1-2 discusses this point in more detail.
The getObject methods return IDfPersistentObject interfaces, because
IDfPersistentObject is the most derived interface that is general to all of the
possible return types. For example, getObject could return an IDfType, an
IDfUser, an IDfDocument, or an IDfFolder (among other possibilities). The
only interfaces common to those types are IDfTypedObject and
IDfPersistentObject. IDfPersistentObject is the more derived. The effect of this
is that Java code must provide an explicit cast. For example
IDfFormat format =
(IDfFormat) mysession.getObjectByQualification
("dm_format where name = 'tex');
The following methods support creating objects and obtaining object
references:
int getDefaultACL()
IDfACL getACL(String aclDomain, String aclName)
IDfFolder getFolderByPath(String folderPath)
IDfFormat getFormat(String formatName)
IDfGroup getGroup(String groupName)
IDfId getIdByQualification(String qualification)
IDfPersistentObject getObject(IDfId objectId)
IDfPersistentObject getObjectByPath(String objectPath)
IDfPersistentObject getObjectByQualification(
String qualification)
IDfPersistentObject getObjectWithType(
IDfId objectId, String objType, String className)
DfPersistentObject newObject(String typeName)
DfPersistentObject newObjectWithType(
String typeName, String className)
DfType getType(String typeName)
DfTypedObject getTypeDescription(
String typeName, String attribute, IDfId businessPolicyId,
String state)
DfUser getUser(String userName)
DfUser getUserByOSName(
String userOSName, String userOSDomain)
Configuration Information
Transaction Support
Docbase Scope
Docbase scope tells the server which Docbase a method applies to. In many
cases this does not change; in other cases, the server can determine it by
examining a method argument that conveys the scope implicitly. For example,
if one of the method’s arguments is an object ID, the server can determine the
Docbase scope from the ID.
The following are the basic methods for managing Docbase scope when
necessary:
String getDocbaseScope()
String setDocbaseScope(String DocbaseName)
String setDocbaseScopeById(IDfId objectId)
Multithreading Support
If more than one thread can access a session, you must take care to lock and
unlock the session before using it.
The following IDfSession methods provide this capability:
boolean lock(int timeoutInMsec);
boolean unlock();
You can lock the session explicitly (calling a method of IDfSession) or
implicitly (calling a method of IDfPersistentObject, because persistent objects
hold a reference to a session).
Generally, you should lock and unlock blocks of code. If you lock and unlock a
session at too fine a granularity, performance suffers and you increase the
chance of making a mistake. If you lock too big a chunk of code, you cause
other threads to wait needlessly, also hurting performance.
DFC does not enforce the locking mechanism on sessions, so a multithreaded
application must be careful to lock and unlock the session. Failure to do so can
cause crashes. The need to protect a session against concurrent access applies
to both shared sessions and private sessions (sessions obtained through the
newSession call), but you must be especially careful if you share sessions
across components in a multithreaded environment. You don’t need to lock
and unlock a session if only one thread at a time can use it.
Tip: In Java you can use the finally statement to ensure that a thread releases
its lock when it dies.
Tip: Lock sessions during transactions to prevent synchronization problems.
API Calls
ByteArrayInputStream apiGetBytes(
String cmd, String args, String buf,
String buflen, int length)
IDfCollection apply(
String objId, String functionName, IDfList args,
IDfList dataType, IDfList values)
IDfCollection getLastCollection()
IDfList apiDesc(String api)
String apiGet(String cmd, String args)
String describe(String type, String objType)
String getMessage(int severityLevel)
boolean apiExec(String cmd, String args)
boolean apiSet(String cmd, String args, String value)
boolean apiSetBytes(
String cmd, String args, ByteArrayOutputStream content)
void traceDMCL(int level, String traceFile)
Administration
IDfId restore(
String predicate, String dumpFile, String operatorName,
int priority, boolean sendMail, IDfTime dueDate)
void changePassword(String oldPasswd, String newPasswd)
void reInit(String serverConfigName)
void reStart(String serverConfigName, boolean restartClient)
void shutdown(boolean immediate, boolean deleteEntry)
Session State
The following methods enable you to control certain aspects of the session:
void disconnect()
void flush(String flushType, String cacheKey)
void flushCache(boolean discardChanged)
void purgeLocalFiles()
void setBatchHint(int batchSize)
Miscellaneous
IDfRelationType getRelationType(String relationName)
IDfVersionTreeLabels getVersionTreeLabels(IDfId chronicleId)
String getLoginTicket()
IDfClient
Most DFC programs start by obtaining an object that implements the
IDfClient interface, through a call like the following:
IDfClient client = DfClient.getLocalClient();
The IDfClient object loads the DMCL shared library. Its main function is to
create and share sessions, but programs also use IDfClient to get information
about the available Docbases and to obtain certain DMCL configuration
information. IDfClient also enables client programs to cache information.
Client applications often present the user with a list of available Docbases.
DFC returns this list through the IDfDocbaseMap interface, which is obtained
by calling the IDfClient getDocbaseMap method. The IDfDocbaseMap
interface provides methods for getting the number of Docbases in the list, the
name of the Docbase at a specified index, a description of the Docbase at the
specified index, and the version of the server at the specified index. IDfClient
also provides methods for obtaining a docbroker map (the list of docbrokers
that you can access) and a server map (the servers that you can access). It
returns these maps as IDfTypedObjects. Typical client applications do not
need these maps. The server documentation provides more information about
them under the headings Docbroker Locator and Server Locator. The
examples in “Using a Docbase Map” on page 4-6 show how to work with
Docbase maps.
IDfClient allows you to obtain information about your general client
configuration through the getClientConfig method. This client configuration
object maps to the API Config object discussed in the server documentation.
Through this object you can dynamically configure such things as your
Docbroker, the maximum number of simultaneous sessions allowed, and the
maximum number of open collections allowed. You should alter the default
values only after reading the server administration documentation.
Service Methods
The IDfClient object provides an IDfProperties object for caching and sharing
information within your application. An IDfProperties object is an object that
allows you to store name-value pairs. The method
getContext(String contextId)
returns the properties object for the specified ID or creates a new one if one
does not already exist. The method
removeContext(String contextId)
removes the specified properties object. Some applications share data within a
session by using this object. In this case, they typically use the session ID
returned by the IDfSession method getSessionId as the context ID. You should
not use the DMCL session ID (for example, s0) for this purpose. Applications
should be careful to remove the properties object associated with a session
when they no longer use that session.
Common Package
The com.documentum.fc.common package contains interfaces that client
programs sometimes find useful.
DFC wraps IDs and Time values in IDfId and IDfTime objects. To get an ID as
a string you can call either getId or toString (they return the same thing).
IDfTime objects allow you to perform time format conversions. Both the IDfId
and IDfTime interfaces provide convenience methods.
The getValue method returns an IDfValue object, which contains not only the
attribute’s value, but also its type. IDfValue objects are convenient when you
need to store an attribute value as an object (such as inserting it into a Java
hashtable), but later need to determine its type as well as its value.
Avoid calling getValue if you can, because creating an additional object and
obtaining and storing the type information are needless overhead if you don’t
use those features.
This chapter assumes that you are familiar with the methods that previous
Documentum client products use to access server capabilities. It explains DFC
by relating it to those methods. It contains the following main sections:
■ “Relationship to DMCL” on page 8-1
This section explains the relationship between DFC and the Documentum
client library (DMCL).
■ “Calling DMCL Directly” on page 8-3
This section describes a way to bypass DFC and to communicate with the
server via DMCL.
■ “DMCL to DFC Correspondence” on page 8-4
This section contains a table of DMCL methods and the corresponding
DFC methods.
Relationship to DMCL
The Documentum client library, DMCL, is a library of procedures and
functions that implement the server API. DFC implements the API and an
additional layer of related business logic, as shown in Figure 8-1. It does so
through a set of interfaces that client programs can use to access DFC from
Java or COM.
DocApp
errHandler:
Dim e As IDfException
Set e = cx.parseException(Err.Description)
MsgBox e.getMessage
finish:
The Visual Basic fragment assumes you have set cx via code like the
following:
Dim cx as IDfClientX
cx = CreateObject(“Documentum.Dfc“)
Method Description
DMCL DFC
DMCL DFC
DMCL DFC
DMCL DFC
DMCL DFC
Id IDfSession :: getIdByQualification
DMCL DFC
Query IDfQuery.execute
Readquery IDfQuery.execute
DMCL DFC
DMCL DFC
A common.documentum.fc.client.qb package
abortTrans method 7-24 1-10
ACLs 6-2 connections
private 6-5 methods related to 3-3
adoptDMCLSession method 7-28 connectToDocbase method 4-7
API calls 7-26 containment objects
API Config object 7-29 copy_child attribute 2-3
apiDesc method 7-26 content objects
apiExec method 6-5, 7-26 methods that work with 3-13
apiGet method 7-26 copy_child attribute 2-3
apiGetBytes method 7-26
apiSet method 6-5, 7-26 D
apiSetBytes method 7-26 dequeue method 7-26
apply method 7-26 describe method 7-26
archive method 7-26 DFC (Documentum Foundation Classes)
attributes COM interface 1-2
methods related to 3-10 elements 1-2
DFC (Documentum foundation classes)
B adopted sessions
beginTrans method 7-24 4-2
bug lists -xii comparison with DMCL 8-4
datatypes 1-7
DMCL process 1-8
C inheritance 1-5
changePassword method 7-27 migrating to 8-4
close method 5-2 naming convention 1-9
collections objects and pointers 1-6
stepping through 5-4 online reference 1-11
COM server API calls
inheritance 1-11 8-4
com.documentum.com package 1-10 shared sessions 4-2
com.documentum.fc.client package 1-10 DFC interface hierarchy 7-5
com.documentum.fc.common package 1- DfClient class 4-2, 4-3, 4-6, 7-27
10, 7-30 DfLoginInfo class 4-3
com.documentum.operations package 1-10 DfPersistentObject class 7-24
com.documentum.registry package 1-10 DfQuery class 5-1
commitTrans method 7-24 DfType class 7-24
DfTypedObject class 7-24