Oracle Content Management SDK

oracle.ifs.beans
Class LibraryObjectDefinition

java.lang.Object
  |
  +--oracle.ifs.beans.LibraryObjectDefinition
Direct Known Subclasses:
PublicObjectDefinition, SchemaObjectDefinition, SystemObjectDefinition

public class LibraryObjectDefinition
extends java.lang.Object

The LibraryObjectDefinition class is used to specify how to construct any Library Object. Generally, a user will use one of the subclasses of LibraryObjectDefinition, e.g. DocumentDefinition to construct a Document.

The main idea behind the use of Definition classes is to afford extensibility to the way objects are created, without having to subclass LibrarySession (on which all create methods are invoked). In order to create a new instance of any object, you first construct a LibraryObjectDefinition object (or one of its subclasses), set all of the desired attributes, and then invoke the appropriate method on LibrarySession (e.g. createDocument, createFolder, etc.) to actually create the object.

Most of the methods that exist on LibraryObjectDefinition do not rely on knowledge of a LibrarySession; hence they generally execute very quickly. Some of the attributes can be set either by name or by object (e.g. setting the ClassObject). In the case when the by-name variant is used, the lookup is not performed until the create method is invoked on LibrarySession, or unless the lookup is explicitly requested, for example by calling resolveClassObject. resolveClassObject requires a LibrarySession parameter, as a connected session is needed to perform the lookup.

As stated before, this class is generally not instantiated directly, as many subclasses are currently defined to create instances of the most common iFS classes. Still, this class implements 3 categories of settings that are generally used by all subclasses of LibraryObjectDefinition:

Note that many Classes of objects have special options that can be specified only by using the appropriate Definition Class. For example, specifying the content for a document you wish to create can only be done with a DocumentDefinition; there is no way to specify content using the LibraryObjectDefinition superclass.


Constructor Summary
LibraryObjectDefinition(LibrarySession session)
          Constructs a LibraryObjectDefinition.
 
Method Summary
 LibraryObjectDefinition clone(LibrarySession sess)
          Clone this instance.
 AttributeValue getAttribute(java.lang.String name)
          Return an AttributeValue object that holds the value of the requested attribute.
 AttributeValue[] getAttributes()
          Return array of Attribute values that were set for this new instance.
 ClassObject getClassObject()
          Return the ClassObject for the new instance.
 java.lang.Object getOption(java.lang.String name)
          Return an option value.
 java.lang.String[] getOptionKeys()
          Return array of option keys
 void removeAttribute(java.lang.String name)
          Removes an attribute setting for the new instance.
 void removeOption(java.lang.String name)
          Removes an option setting for the new instance.
 void setAttribute(AttributeValue value)
          Set an attribute for the new instance.
 void setAttribute(java.lang.String name, AttributeValue value)
          Set an attribute for the new instance.
 void setAttributeByUpperCaseName(java.lang.String attrkey, AttributeValue value)
          Set an attribute for the new instance.
 void setAttributes(AttributeValue[] values)
          Set a number of attributes for the new instance.
 void setClassObject(ClassObject libraryClass)
          Set the ClassObject for the new instance.
 void setOption(java.lang.String name, java.lang.Object value)
          Set an option for the new instance.
 

Constructor Detail


LibraryObjectDefinition

public LibraryObjectDefinition(LibrarySession session)
                        throws IfsException
Constructs a LibraryObjectDefinition.
Parameters:
session - the session
Throws:
IfsException - if the operation fails
Method Detail

clone

public LibraryObjectDefinition clone(LibrarySession sess)
                              throws IfsException
Clone this instance.
Parameters:
sess - the session.
Returns:
the cloned definition.
Throws:
IfsException - if operation fails.

setAttribute

public void setAttribute(java.lang.String name,
                         AttributeValue value)
                  throws IfsException
Set an attribute for the new instance. Each invocation of this method results in another attribute setting being added to an internal list. When definition is completely specified, it is passed to the appropriate LibrarySession.createXXXObject() method, where XXX is Public, Schema, or System. The createXXXObject method returns the newly persistent object.

LibraryDefinitions are also used for update, free, and other repository operations as a way to specify options to the operation.

To set an attribute to the null value (e.g., for the purpose of updating an object), you need to pass in an AttributeValue instance with its value set to null (see AttributeValue.newNullAttributeValue); note that this is not the same as passing null for the AttributeValue parameter. The latter removes the attribute from the internal list of specified values (i.e. behaves as if the attribute was never set in this definition).

Parameters:
name - The attribute name
value - The attribute value.
Throws:
IfsException - if operation fails.

setAttributeByUpperCaseName

public void setAttributeByUpperCaseName(java.lang.String attrkey,
                                        AttributeValue value)
                                 throws IfsException
Set an attribute for the new instance. The caller ensures that the key specified is forced to uppercase. Each invocation of this method results in another attribute setting being added to an internal list.
Parameters:
name - The attribute name
value - The attribute value.
Throws:
IfsException - if operation fails.

setAttribute

public void setAttribute(AttributeValue value)
                  throws IfsException
Set an attribute for the new instance. Each invocation of this method results in another attribute setting being added to an internal list.
Parameters:
name - The attribute name
value - The attribute value.
Throws:
IfsException - if operation fails.

setAttributes

public void setAttributes(AttributeValue[] values)
                   throws IfsException
Set a number of attributes for the new instance. The names of the attributes must be contained in each attribute value.
Parameters:
values - The attribute values.
Throws:
IfsException - if operation fails.

getAttribute

public AttributeValue getAttribute(java.lang.String name)
                            throws IfsException
Return an AttributeValue object that holds the value of the requested attribute.
Parameters:
name - the name of the AttributeValue to be returned
Returns:
the corresponding AttributeValue
Throws:
IfsException - if operation fails.

setOption

public void setOption(java.lang.String name,
                      java.lang.Object value)
               throws IfsException
Set an option for the new instance.
Parameters:
name - The option name
value - The option value.
Throws:
IfsException - if operation fails.

getOption

public java.lang.Object getOption(java.lang.String name)
                           throws IfsException
Return an option value.
Parameters:
name - the name of the option
Returns:
the corresponding Value for the option
Throws:
IfsException - if operation fails.

getOptionKeys

public java.lang.String[] getOptionKeys()
                                 throws IfsException
Return array of option keys
Returns:
array of option keys
Throws:
IfsException - if operation fails.

setClassObject

public void setClassObject(ClassObject libraryClass)
                    throws IfsException
Set the ClassObject for the new instance. All iFS subclasses of LibraryObjectDefinition have a default class. For example DocumentDefinition has a default class of DOCUMENT. You only need to call this method if you wish to specify a subclass of the default class (e.g., MySubclassOfDOCUMENT)
Parameters:
libraryClass - the desired LibraryObject Class
Throws:
IfsException - if operation fails.

getClassObject

public ClassObject getClassObject()
                           throws IfsException
Return the ClassObject for the new instance.
Returns:
the ClassObject to be used for the new instance.

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws IfsException
Removes an attribute setting for the new instance.
Parameters:
name - The name of the Attribute to be removed.
Throws:
IfsException - if operation fails.

removeOption

public void removeOption(java.lang.String name)
                  throws IfsException
Removes an option setting for the new instance.
Parameters:
name - The name of the option to be removed.
Throws:
IfsException - if operation fails.

getAttributes

public AttributeValue[] getAttributes()
                               throws IfsException
Return array of Attribute values that were set for this new instance. The name of the attribute is set in the returned AttributeValues. The returned AttributeValue names are locked.
Returns:
AttributeValue array of the currently set attributes

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.