FileNet Content Services
Java Connector v3.0

com.filenet.Panagon
Class ObjectFactory

java.lang.Object
  extended bycom.filenet.Panagon.ObjectFactory

public class ObjectFactory
extends java.lang.Object

The ObjectFactory class creates new objects and empty collection objects through a set of static methods. Since all of this class's methods are static, you never need to create a new instance of ObjectFactory.

You can use ObjectFactory to create the following objects:

You can also use ObjectFactory to create the following collection objects:

Note that there are two variants of the method to create a PropertyDescriptions collection object. The no-parameter form creates an empty collection; the other form populates the new collection with elements.

See Also:
CS Java Toolkit Developer's Guide

Method Summary
static ClassDescriptions getClassDescriptions()
          Creates an empty ClassDescriptions collection, to which you can add ClassDescription objects.
static EntireNetwork getEntireNetwork(Session sess)
          Creates a new EntireNetwork object, from which your application can obtain access to all object stores (libraries) in the EntireNetwork.properties, a configuration file in the CS Java Toolkit.
static ObjectStore getObjectStore(java.lang.String objectStoreId, Session sess)
          Creates an ObjectStore (library) object.
static ObjectStores getObjectStores(Session sess)
          Creates an empty ObjectStores collection to which you can add ObjectStore objects.
static Permission getPermission(int access, int accessType, SecurityGrantee groupOrUser)
          Creates a Permission object, which you can add to the Permissions collection of a Folder or Document object.
static Permission getPermission(int access, int accessType, java.lang.String groupOrUserName, int groupOrUserType)
          Creates a Permission object, which you can add to the Permissions collection of a Folder or Document object.
static Permissions getPermissions()
          Creates an empty Permissions collection object to which you can add Permission objects.
static Properties getProperties()
          Creates an empty Properties collection to which you can add Property objects.
static Property getProperty(java.lang.String propertyName)
          Creates a new Property object.
static PropertyDescription getPropertyDescription(java.lang.String propertyName)
          Creates a PropertyDescription object.
static PropertyDescriptions getPropertyDescriptions()
          Creates an empty PropertyDescriptions collection object to which you can add PropertyDescription objects.
static PropertyDescriptions getPropertyDescriptions(java.lang.String[] propertyNames)
          Creates a PropertyDescriptions collection suitable for passing into any of the methods that take a collection of PropertyDescription objects.
static Search getSearch(Session sess)
          Creates a Search object.
static Session getSession(java.lang.String appId)
          Creates a Session object used to connect to the Content Services server.
static Session getSession(java.lang.String appId, java.lang.String credTag)
          Creates a Session object used to connect to the Content Services server.
static Session getSession(java.lang.String appId, java.lang.String credTag, java.lang.String userId, java.lang.String password, java.lang.String domain)
          Creates a Session object used to connect to the Content Services server.
static Value getValue()
          Creates a Value object, which you can add to a Values collection.
static Values getValues()
          Creates an empty Values collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEntireNetwork

public static EntireNetwork getEntireNetwork(Session sess)

Creates a new EntireNetwork object, from which your application can obtain access to all object stores (libraries) in the EntireNetwork.properties, a configuration file in the CS Java Toolkit. An EntireNetwork object represents the overall structure of object stores known to the Content Services.

This method takes a Session object argument. Authentication performed at the Content Services server uses credentials information contained in the Session object.

Parameters:
sess - The Session object that supplies logon credentials to the Content Services server.

Returns:
An EntireNetwork object.

getProperty

public static Property getProperty(java.lang.String propertyName)

Creates a new Property object. A single Property object can have one or more values. The property is returned with default values as specified in its PropertyDescription object.

After setting the necessary values on the Property object, you can add it to a Properties collection to be used, for example, in a setProperties call on an object such as a Folder or Document.

Parameters:
propertyName - A String representing the symbolic name of the property.

Returns:
A Property object.

getProperties

public static Properties getProperties()

Creates an empty Properties collection to which you can add Property objects.

Returns:
An empty Properties collection.

getClassDescriptions

public static ClassDescriptions getClassDescriptions()

Creates an empty ClassDescriptions collection, to which you can add ClassDescription objects.

Returns:
An empty ClassDescriptions collection.

getObjectStore

public static ObjectStore getObjectStore(java.lang.String objectStoreId,
                                         Session sess)

Creates an ObjectStore (library) object. This ObjectStore object is a representation of the persisted object store on the Content Services server.

This method takes an object store identifier as an object store name, which must be a concatenation of the library name, the carat character, and host machine name. For example, for a Content Services library named "Aslan" on an server named "Narnia", the value would be Aslan^Narnia.

In addition to supplying an object store identifier, you pass a Session object to this method. Authentication performed at the Content Services server uses credentials information contained in the Session object. (To create a Session object, see getSession.)

Parameters:
objectStoreId - A String representing the ID of the object store on the Content Server server. The ID must be specified in this format: libraryName^hostMachine.

sess - The Session object that supplies logon credentials to the Content Server server.

Returns:
An ObjectStore object.

getObjectStores

public static ObjectStores getObjectStores(Session sess)
Creates an empty ObjectStores collection to which you can add ObjectStore objects.

Returns:
An empty ObjectStores collection.

getPropertyDescription

public static PropertyDescription getPropertyDescription(java.lang.String propertyName)

Creates a PropertyDescription object. The argument to this method is a String that represents the symbolic name of the property for which you want to create a property description. The method returns a PropertyDescription object with this name; the returned object is not populated with metadata from the Content Services server. Calls to methods on a PropertyDescription object that was created by ObjectFactory.getPropertyDescription() will fail if the calling methods require object store access.

The intended use of a PropertyDescription object created by this method is as an element in a collection that you pass to other methods that take a PropertyDescriptions collection as an argument. (Use getPropertyDescriptions() to create a collection to which you can add PropertyDescription objects.)

To create a PropertyDescription object that is populated with metadata, call either getPropertyDescriptions on the ObjectStore interface or getPropertyDescriptions on the ClassDescription interface. (Several forms of these methods are available.) The PropertyDescription objects returned from these methods are populated with a full range of metadata from the Content Services server.

Parameters:
propertyName - A String representing the symbolic name of the property.

Returns:
A PropertyDescription object.

getPropertyDescriptions

public static PropertyDescriptions getPropertyDescriptions(java.lang.String[] propertyNames)

Creates a PropertyDescriptions collection suitable for passing into any of the methods that take a collection of PropertyDescription objects. The argument to this method is a string array that contains property symbolic names.

For example:

 ObjectFactory.getPropertyDescriptions(new String[]
         {Property.DISPLAY_NAME,Property.CONTAINER});

Parameters:
propertyNames - A String array of property symbolic names.

Returns:
A PropertyDescriptions collection object.

getPermissions

public static Permissions getPermissions()
Creates an empty Permissions collection object to which you can add Permission objects.

Returns:
An empty Permissions collection object.

getPermission

public static Permission getPermission(int access,
                                       int accessType,
                                       SecurityGrantee groupOrUser)

Creates a Permission object, which you can add to the Permissions collection of a Folder or Document object. A Permission object represents an access control (or rule) associated with a Folder or Document object.

Parameters:
access - An integer that represents the access level to an object for a user or group. Integers can be specified as constants, for example IdmAccessAuthor. The access constants are defined in the com.filenet.Panagon.Permission interface.

accessType - An integer that specifies to allow access. You can use the constant TYPE_ALLOW, as defined in the com.filenet.wcm.api.Permission interface.

groupOrUser - A Group or User object (which implement the SecurityGrantee interface) specifying either the group for example, "Managers") or user (for example, "TestUser") being granted the permission. Note that the group or user must already exist on the Content Services server. You can instantiate a persisted Group object or User object from a Groups or Users collection, respectively.

Returns:
A Permission object.

getPermission

public static Permission getPermission(int access,
                                       int accessType,
                                       java.lang.String groupOrUserName,
                                       int groupOrUserType)

Creates a Permission object, which you can add to the Permissions collection of a Folder or Document object. A Permission object represents an access control (or rule) associated with a Folder or Document object.

Parameters:
access - An integer that represents the access level to an object for a user or group. Integers can be specified as constants, for example IdmAccessAuthor. The access constants are defined in the com.filenet.Panagon.Permission interface.

accessType - An integer that specifies to allow access. You can use the constant TYPE_ALLOW, as defined in the com.filenet.wcm.api.Permission interface.

groupOrUserName - A String specifying the name of either the group for example, "Managers") or user (for example, "TestUser") being granted the permission. Note that the group or user must already exist on the Content Services server.

groupOrUserType - An integer specifying whether access is being granted to a group or user. You can specify one of the constants defined in BaseObject: either BaseObject.TYPE_GROUP or BaseObject.TYPE_USER.

Returns:
A Permission object.

getPropertyDescriptions

public static PropertyDescriptions getPropertyDescriptions()
Creates an empty PropertyDescriptions collection object to which you can add PropertyDescription objects.

Returns:
A PropertyDescriptions collection.

getValue

public static Value getValue()

Creates a Value object, which you can add to a Values collection. Each Value object represents the value assigned to a Property object.

The following code fragment creates a Value object and sets the value to true:

Value v = ObjectFactory.getValue();
 v.setValue(true);

Returns:
A Value object.

getValues

public static Values getValues()
Creates an empty Values collection. Using the Values collection interface, you can, for example, add, remove, insert, and clear Value objects from the collection.

Returns:
An empty Values collection.

getSearch

public static Search getSearch(Session sess)

Creates a Search object. Through the Search object interface, your application can perform queries using SQL contained in XML-formatted strings.

Parameters:
sess - The Session object that supplies logon credentials to the Content Services server.

Returns:
A Search object.

getSession

public static Session getSession(java.lang.String appId)

Creates a Session object used to connect to the Content Services server. This method is a convenience form of the basic getSession method. It requires only one parameter, appId, and supplies Java null for the unspecified parameters.

See getSession for information on the basic form of this method.

The following example creates a Session object with an application identifier for the MyTestApp application and immediately verifies the credentials in the Session object:

Session sess = ObjectFactory.getSession("com.example.apps.MyTestApp");
 sess.verify();

Parameters:
appId - Required. A String representing a unique application name. This parameter cannot be null and cannot contain a forward slash character (/).

Returns:
A Session object.


getSession

public static Session getSession(java.lang.String appId,
                                 java.lang.String credTag)

Creates a Session object used to connect to the Content Services server. This method is a convenience form of the basic getSession method. It requires only two parameters, appId and credTag, and supplies Java null for the unspecified parameters.

See getSession for information on the basic form of this method.

The following example creates a Session object with an application identifier for the MyTestApp application and a protection level of "Clear" (no encryption), then immediately verifies the credentials of the Session object:

 Session sess = ObjectFactory.getSession("com.example.apps.MyTestApp",Session.CLEAR);
 sess.verify();

Parameters:
appId - Required. A String representing a unique application name. This parameter cannot be null and cannot contain a forward slash character (/).

credTag - A String identifying a protection level for credentials being sent to the Content Services server for authentication, or null (preferred). Protection levels are defined in the Session interface.

Returns:
A Session object.


getSession

public static Session getSession(java.lang.String appId,
                                 java.lang.String credTag,
                                 java.lang.String userId,
                                 java.lang.String password,
                                 java.lang.String domain)

Creates a Session object used to connect to the Content Services server. This method is the basic form of getSession. With the exception of appId, any of the parameters can be null. Specifying Java null or Session.DEFAULT for the credTag parameter causes the method to use the protection level specified by the site administrator in the site configuration file.

The parameters of the getSession method map to the components of the credentials token carried in the Session object. (These components are described in CS Java Toolkit Developer's Guide

Note: if you do not set values for credentials token components in your initial getSession() call, you can set the values immediately after creating the Session object but before taking any action that would cause an attempted connection to the Content Services server. Use Session.setUserid(), Session.setPassword(), and Session.setDomain() methods as appropriate.

The following code fragment creates a Session object. The call to getSession supplies an application identifier for the MyTestApp application and the userid ("tester"). Java null is used for all other parameters.

Session sess = ObjectFactory.getSession("com.example.apps.MyTestApp",
     null, "tester", null, null);
 sess.verify(); //immediately verify the session credentials

(Two convenience forms of this method are available for your use: getSession(String appId) and getSession(String appId, String credTag).)

Parameters:
appId - Required. A String representing a unique application name. This parameter cannot be null and cannot contain a forward slash character (/).

credTag - A String identifying a protection level for credentials being sent to the Content Services server for authentication, or null (preferred). Protection levels constants are defined in the Session interface.

userId - A String representing the userid to be logged on, or null.

password - A String representing the password to be used to logon to the Content Services server account, or null.

domain - Set this to null.

Returns:
A Session object.


FileNet Content Services
Java Connector v3.0