FileNet Content Services
Java Connector v3.0

com.filenet.wcm.api
Class ObjectFactory

java.lang.Object
  extended bycom.filenet.wcm.api.ObjectFactory

public class ObjectFactory
extends java.lang.Object

Not Applicable in CS Java Connector v3.0.

The ObjectFactory class creates new objects and empty collection objects through a set of static methods. (One exception to creating empty collection objects is the getPropertyDescriptions method. This method has two forms: the no-parameter form creates an empty collection; the other form populates the new collection with elements.) Since all of this class's methods are static, you never need to create a new instance of ObjectFactory.

Not all object and collection object types can be created with this class. Note that the objects and collections you can create with ObjectFactory are intended for use as a parameter to methods on other objects. Depending on your purpose for creating an object, you may choose to call a method on some other object instead of using ObjectFactory. For example, to create a new, populated ObjectStores collection object, call getObjectStores() on the Domain interface, which returns a collection populated with object store elements associated with the FileNet P8 domain. To create a new, empty ObjectStores collection object, call ObjectFactory.getObjectStores, which returns an empty collection to which you can add specific object store elements.

Objects and collection objects created via ObjectFactory methods are not populated with actual data from the object store, but rather with data supplied internally by the static method or with data you provide in the parameters to the method. It is possible to populate these objects with invalid data for your object store. In many cases, doing so will not cause an exception to be thrown until the object is passed to a method.

You can use the ObjectFactory class to create the following objects:

When you create EntireNetwork, ObjectStore, Search, and SecurityGrantee objects, you must supply a Session object as an argument. Authentication performed at the Content Services server uses credentials information contained in the Session object.

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.


Method Summary
static ClassDescriptions getClassDescriptions()
          

Not Applicable in CS Java Connector v3.0.

static EntireNetwork getEntireNetwork(Session sess)
          

Not Applicable in CS Java Connector v3.0.

static SecurityGrantee getGrantee(java.lang.String granteeName, int granteeType, Session sess)
          

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

static ObjectStores getObjectStores()
          

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

static Permissions getPermissions()
          

Not Applicable in CS Java Connector v3.0.

static Properties getProperties()
          

Not Applicable in CS Java Connector v3.0.

static Property getProperty(java.lang.String propertyName)
          

Not Applicable in CS Java Connector v3.0.

static PropertyDescription getPropertyDescription(java.lang.String propertyName)
          

Not Applicable in CS Java Connector v3.0.

static PropertyDescriptions getPropertyDescriptions()
          

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

static Search getSearch(Session sess)
          

Not Applicable in CS Java Connector v3.0.

static SecurityTemplate getSecurityTemplate()
          

Not Applicable in CS Java Connector v3.0.

static SecurityTemplate getSecurityTemplate(java.lang.String classId, java.lang.String applyStateId)
          

Not Applicable in CS Java Connector v3.0.

static Session getSession(java.lang.String appId)
          

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

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

Not Applicable in CS Java Connector v3.0.

static Session getSession(java.lang.String appId, java.lang.String credTag, java.lang.String userId, java.lang.String password, java.lang.String domain)
          Deprecated. Use (appId, credTag, userId, password) form of this method.
static Value getValue()
          

Not Applicable in CS Java Connector v3.0.

static Values getValues()
          

Not Applicable in CS Java Connector v3.0.

 
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)

Not Applicable in CS Java Connector v3.0.

Creates a new EntireNetwork object, from which your application can obtain access to the FileNet P8 domain and all object stores in the GCD of the Content Services server. An EntireNetwork object represents the overall structure of the domain and object stores known to the Content Services server.

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

Returns:
An EntireNetwork object.

getProperty

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

Not Applicable in CS Java Connector v3.0.

Creates a new Property object with default values as specified in its PropertyDescription object. A single Property object can have one or more values. 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.

Returns:
A Property object.

getProperties

public static Properties getProperties()

Not Applicable in CS Java Connector v3.0.

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

Returns:
An empty Properties collection.

getClassDescriptions

public static ClassDescriptions getClassDescriptions()

Not Applicable in CS Java Connector v3.0.

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)

Not Applicable in CS Java Connector v3.0.

Creates an ObjectStore object. This ObjectStore object is a representation of the persisted object store on the Content Engine server.

This method takes an object store identifier as a parameter. You can pass an object store identifier as a GUID or as the object store name.

In addition to supplying an object store identifier, this method requires a Session object.

Parameters:
objectStoreId - A String representing the ID of the object store on the Content Services server.

sess - The Session object that supplies authentication credentials to the Content Services server.

Returns:
An ObjectStore object.

getObjectStores

public static ObjectStores getObjectStores()

Not Applicable in CS Java Connector v3.0.

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)

Not Applicable in CS Java Connector v3.0.

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 an empty 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 an object store access.

The intended use of a PropertyDescription object created by this method is as an element in a PropertyDescriptions collection argument that you pass to other methods. (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.)

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

Returns:
A PropertyDescription object.

getPropertyDescriptions

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

Not Applicable in CS Java Connector v3.0.

Creates a PropertyDescriptions collection suitable for passing into any method that takes such a collection as an argument. The argument to this method is a String array that contains property symbolic names. For example:
 PropertyDescriptions collPDs = ObjectFactory.getPropertyDescriptions(new String[]
         {Property.DISPLAY_NAME,Property.CREATOR,Property.CONTAINER});

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

Returns:
A PropertyDescriptions collection object.

getPermissions

public static Permissions getPermissions()

Not Applicable in CS Java Connector v3.0.

Creates an empty Permissions collection object to which you can add Permission objects. A Permission object represents a rule associated with an object that regulates which users can gain access to the object and in what manner.

Returns:
An empty Permissions collection object.

getPermission

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

Not Applicable in CS Java Connector v3.0.

Creates a Permission object, which you can add to the Permissions collection of an object such as a Folder or Document. A Permission object represents a rule associated with an object that regulates which users can gain access to the object and in what manner.

The integer passed in the access parameter specifies the access rights being granted. The integer is a bit mask of values ORed together that defines the rights of the specified user or group to access an object on the Content Services server. The accessType parameter specifies whether access is allowed (Permission.TYPE_ALLOW) or denied (Permission.TYPE_DENY). (See the Permission interface for descriptions of these constants.) The SecurityGrantee parameter specifies the Group or the User to which the access is being granted or denied.

Parameters:
access - An integer that represents a bit mask of the security access rights being granted. Integers can be specified as constants, as defined in the Permission interface.

accessType - An integer that specifies whether the access is being granted (Permission.TYPE_ALLOW) or being denied (Permission.TYPE_DENY) to the group or user.

groupOrUser - A SecurityGrantee object.

Returns:
A new Permission object.

getPermission

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

Not Applicable in CS Java Connector v3.0.

Creates a SecurityGrantee object. This SecurityGrantee object is a representation of the persisted SecurityGrantee on the Content Engine server.

This method takes a user or group identifier as a parameter. The identifier can be specified as the ID of the object or its principal name. You can obtain the ID by calling getId() on the Group or User interface. You can obtain a principal name by calling a Permission object's getGranteeName method. If using the principal name, it must be specified in a format compatible with the authentication provider, and cannot be the short name. Using the "tester" user account as an example, specify the principal name as follows for the supported authentication provider environments:

In addition to supplying an object identifier and object type (user or group), this method requires a Session object.

Although the returned SecurityGrantee object is locally instantiated, its methods work as expected (for example, you can call the getParentGroups method to retrieve the collection of groups that a grantee belongs to). You can also use the returned SecurityGrantee object in a call to ObjectFactory.getPermission(access, accessType, groupOrUser) to create a Permission object.

To retrieve the ID of the object returned by this getGrantee method when granteeName is not a GUID, call getPropertyStringValue(Property.ID), instead of getId().

Returns:
A SecurityGrantee object.

getPropertyDescriptions

public static PropertyDescriptions getPropertyDescriptions()

Not Applicable in CS Java Connector v3.0.

Creates an empty PropertyDescriptions collection object to which you can add PropertyDescription objects.

Returns:
A PropertyDescriptions collection.

getValue

public static Value getValue()

Not Applicable in CS Java Connector v3.0.

Creates a Value object. 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()

Not Applicable in CS Java Connector v3.0.

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)

Not Applicable in CS Java Connector v3.0.

Creates a Search object. Through the Search object interface, your application can perform queries using ADO.

Refer to the Search interface for a code sample that creates a Search object.

Returns:
A Search object.

getSession

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

Not Applicable in CS Java Connector v3.0.

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 - 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)

Not Applicable in CS Java Connector v3.0.

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 - 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).

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)

Not Applicable in CS Java Connector v3.0.

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

Note that for a user ID containing an equal sign, comma, or backward slash character, you must use escape characters. Refer to the table of escape characters in Creating a Session.

The following code fragment creates a Session object. The getSession call supplies an application identifier for the MyTestApp application, a userid of "tester", and null for all other parameters.

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

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

Parameters:
appId - 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). Constants for this string are defined in the Session interface.

userId - A String representing the userid to be logged on. Can be null. Use escape characters for user IDs that contain an equal sign, a comma, or a backward slash character.

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

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)
Deprecated. Use (appId, credTag, userId, password) form of this method.

Not Applicable in CS Java Connector v3.0.


getSecurityTemplate

public static SecurityTemplate getSecurityTemplate(java.lang.String classId,
                                                   java.lang.String applyStateId)

Not Applicable in CS Java Connector v3.0.

Creates a new SecurityTemplate object. Specify the template type in the classId parameter using the appropriate constant defined in the ClassDescription interface. Valid values are ClassDescription.APPLICATION_SECURITY_TEMPLATE or ClassDescription.VERSIONING_SECURITY_TEMPLATE.

When creating a versioning security template, the applyStateId parameter is a GUID that corresponds to a version state, represented by a constant defined in the VersionableObject interface. Valid values are:
APPLY_STATE_ID_IN_PROCESS
APPLY_STATE_ID_RELEASED
APPLY_STATE_ID_RESERVATION
APPLY_STATE_ID_SUPERSEDED

Note that it is possible to create a mismatched SecurityTemplate object by specifying a value for applyStateId other than one of those listed above. Although the Content Services Java Connector does not enforce the use of the versioning applyStateId values with a versioning security template class ID, the Content Services does. If you attempt to create (or modify) a SecurityPolicy object with such a mismatched SecurityTemplate object, the Content Services will return an error.

When creating an application security template, the value you specify for applyStateId is a user-defined GUID managed by your application. You can also use the getSecurityTemplate() form of this method, which automatically generates a GUID for the template's apply state.

Parameters:
classId - A String representing the GUID of the class to create.

applyStateId - A String representing the GUID which tags the SecurityTemplate object for use with a particular version- or application-managed state.

Returns:
A SecurityTemplate object.


getSecurityTemplate

public static SecurityTemplate getSecurityTemplate()

Not Applicable in CS Java Connector v3.0.

Creates a new SecurityTemplate object with an automatically-generated unique identifier for its apply state. This method is intended for creating application security templates. The class identifier defaults to a template type of ClassDescription.APPLICATION_SECURITY_TEMPLATE. To create a versioning template with a specific apply state ID, use getSecurityTemplate(classId, applyStateId).

The identifier automatically generated by this method is a pseudo-GUID that corresponds to the state of an object. It does not comply with GUID specifications. Rather, the returned string is equivalent to a value generated by using the java.rmi.server.UID utility, plus random numbers, to create a unique string. (To generate a GUID that conforms to standard industry GUID format, use an approach of your choice that will yield unique settings.) The identifier is used as input to the applySecurityTemplate method of a Document, CustomObject, or Folder object.

Returns:
A SecurityTemplate object.


getGrantee

public static SecurityGrantee getGrantee(java.lang.String granteeName,
                                         int granteeType,
                                         Session sess)

Not Applicable in CS Java Connector v3.0.

Creates a SecurityGrantee object. This SecurityGrantee object is a representation of the persisted SecurityGrantee on the Content Engine server.

This method takes a user or group identifier as a parameter. You can specify the identifier as the ID of the object or as its principal name. You can obtain the ID by calling getId() on the Group or User interface. You can obtain a principal name by calling a Permission object's getGranteeName method. If using the principal name, it must be specified in a format compatible with the authentication provider, and cannot be the short name. As an example, for the user named "tester" in a Microsoft Active Directory environment, specify the UPN (user principal name): tester@example.com. In a Sun Java System Directory Server or Novell eDirectory environment, specify the principal name in the following format: UID=tester,dc=example,dc=com.

In addition to supplying an object identifier and object type (user or group), this method requires a Session object.

Although the returned SecurityGrantee object is locally instantiated, its methods work as expected (for example, you can call the getParentGroups method to retrieve the collection of groups that a grantee belongs to). You can also use the returned SecurityGrantee object in a call to ObjectFactory.getPermission(access, accessType, groupOrUser) to create a Permission object.

To retrieve the ID of the object returned by this getGrantee method when granteeName was specified as a name and not as an ID, call getPropertyStringValue(Property.ID), instead of getId(). When created with getGrantee, the format of the object's ID is unknown, so getId() simply returns whatever you passed in via the granteeName parameter. As an example, if you passed in a principal name, getId() returns the principal name; if you passed in a security ID (SID), getId() returns the SID. If you passed in a principal name, but you want to retrieve the SID, call getPropertyStringValue(Property.ID).

Parameters:
granteeName - A String representing the ID of the object on the Content Services server. The ID can be the principal name of the grantee or the value returned by Group.getId() or User.getId(). If using the principal name, it must be specified in a format compatible with the authentication provider, and cannot be the short name.

granteeType - An int specifying the type of the object on the Content Services server. This parameter must be either BaseObject.TYPE_GROUP or BaseObject.TYPE_USER.

sess - The Session object that supplies authentication credentials to the Content Services server.

Returns:
A SecurityGrantee object.

FileNet Content Services
Java Connector v3.0