com.filenet.wcm.apps.server.util
Class WcmPropertiesUtil

java.lang.Object
  extended bycom.filenet.wcm.apps.server.util.WcmPropertiesUtil
Direct Known Subclasses:
WcmDesignerPropertiesUtil

public class WcmPropertiesUtil
extends java.lang.Object

This properties utility handles all XML DOM manipulation. It makes use of XPath and includes routines to handle validation.


Constructor Summary
WcmPropertiesUtil()
           
 
Method Summary
 org.w3c.dom.Document addAllPropValues(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String symname, int cvlSize, java.util.Locale locale)
          Adds all of the indicated prop values from the choice list to the output XML.
 org.w3c.dom.Document addDefaultValues(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String symName, java.util.Locale locale)
          Adds the default values to a newly created output XML buffer.
 org.w3c.dom.Document addPropValues(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String symname, java.lang.String[] values, java.util.Locale locale)
          Add the given values to the Document property with the given id.
static java.lang.String getCompoundDocumentState(org.w3c.dom.Document propertiesXML)
          Returns the top level classdesc id or null if not found.
 java.lang.String getCustomObjectName(org.w3c.dom.Document propsDoc, WcmWorkplaceConfig config)
          Returns the custom object name using the site preferences.
 java.lang.String getDocumentName(org.w3c.dom.Document propsDoc, WcmWorkplaceConfig config)
          Returns the document name using the site preferences.
 java.lang.String getFolderName(org.w3c.dom.Document propsDoc, WcmWorkplaceConfig config)
          Returns the folder name using the site preferences.
static WcmPropertiesUtil getPropertiesUtil()
          Get accessor returns instance of this object
 java.lang.String getTopClassId(org.w3c.dom.Document classesXML)
          Returns the top level classdesc id or null if not found.
 boolean initializeClientProps(org.w3c.dom.Document output, org.w3c.dom.Document propertyDescriptions, javax.servlet.http.HttpServletRequest request, java.util.Map propertyValues, com.filenet.wcm.toolkit.server.base.WcmController controller)
          For AppInt/Client modes.
 boolean isEndNode(org.w3c.dom.Document choicesDoc, java.lang.String selectedID)
          Use this method to determine if the selected ID represents an end node.
 org.w3c.dom.Document moveDown(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String symname, java.lang.String[] sMove, java.util.Locale locale)
          Moves the selected items down in the list.
 java.lang.String[] moveDown(java.lang.String[] sArray, java.lang.String[] sMove)
          The actual work part of moving elements down in an array
 org.w3c.dom.Document moveUp(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String symname, java.lang.String[] sMove, java.util.Locale locale)
          Move the selected items up in the list
 java.lang.String[] moveUp(java.lang.String[] sArray, java.lang.String[] sMove)
          The actual work part of moving elements up in an array
static void openExceptionPage(java.util.List exceptions, com.filenet.wcm.toolkit.server.base.WcmController controller, java.lang.String moduleName)
          Opens a popup window with the exceptions displayed
static void openExceptionPage(java.util.List exceptions, com.filenet.wcm.toolkit.server.base.WcmController controller, java.lang.String moduleName, boolean isPopUp, java.lang.String pageTitle, java.lang.String returnUrl)
          Opens a popup window with the exceptions displayed
 void openExceptionPage(com.filenet.wcm.toolkit.util.WcmException exception, com.filenet.wcm.toolkit.server.base.WcmController controller, java.lang.String moduleName)
          Opens a popup window with the exceptions displayed
 void testFolderChars(java.lang.String chars, java.util.Locale locale, java.lang.String symName, java.lang.String propName, java.util.ArrayList exceptions)
           
 org.w3c.dom.Document updateComponentRelationshipClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document relationshipClass)
          Updates the Component Relationship class with the indicated sID
 org.w3c.dom.Document updateCustomObjectClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document customObjectClasses, java.lang.String sID)
          Updates the CustomOBjectClass with the indicated sID
 org.w3c.dom.Document updateDocClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document docClasses, java.lang.String sID)
          Updates the DocClass with the indicated sID
 org.w3c.dom.Document updateFolderClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document folderClasses, java.lang.String sID)
          Update the folderClass with the folder Class with the indicated sID
 org.w3c.dom.Document updateLinkClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document linkClasses, java.lang.String ID)
          Updates the Link class with the indicated sID
 boolean updateProp(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, java.lang.String prefix, java.lang.String symName, javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
          Updates the Document with values returned in the request object.
 boolean updatePropChoice(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, org.w3c.dom.Document choicesDoc, java.lang.String symName, java.lang.String choiceID, java.util.Locale locale)
          Updates the Document property choice with the given choice id value.
 boolean updateProps(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, javax.servlet.http.HttpServletRequest request, java.util.Locale locale, java.lang.String prefix, com.filenet.wcm.toolkit.server.base.WcmController controller, java.lang.String moduleName)
          Updates the Document with values returned in the request object.
 boolean updateProps(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, javax.servlet.http.HttpServletRequest request, java.util.Locale locale, com.filenet.wcm.toolkit.server.base.WcmController controller, java.lang.String moduleName)
          Updates the Document with values returned in the request object.
 boolean updatePropValues(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, org.w3c.dom.Document valuesDoc, java.lang.String symbolicName, java.util.Locale locale)
          Updates the Document property with the given values.
 org.w3c.dom.Document updateSecurityPolicyClass(org.w3c.dom.Document outputDoc, org.w3c.dom.Document securityPolicyClasses, java.lang.String sID)
          Updates the SecurityPolicyClass with the indicated sID
 java.util.ArrayList validate(org.w3c.dom.Document outputDoc, org.w3c.dom.Document propDescsDoc, boolean isFolder, java.util.Locale locale, java.lang.String moduleName, com.filenet.wcm.toolkit.server.base.WcmController controller)
          Checks the output XML Document to validate each entered value and to see if all of the required properties have been filled.
 java.lang.String validate(org.w3c.dom.Document propDescsDoc, java.lang.String symName, java.lang.String dataType, java.lang.String propVal, java.util.Locale locale, java.util.TimeZone tz)
          Rudimentary validation of the given property value using the given property description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WcmPropertiesUtil

public WcmPropertiesUtil()
Method Detail

getPropertiesUtil

public static WcmPropertiesUtil getPropertiesUtil()
                                           throws java.lang.Exception
Get accessor returns instance of this object

Returns:
An instance of this class
Throws:
java.lang.Exception

getTopClassId

public java.lang.String getTopClassId(org.w3c.dom.Document classesXML)
                               throws java.lang.Exception
Returns the top level classdesc id or null if not found.

Parameters:
classesXML - XML Document that contains the object store doc classes
Returns:
A string representing the class id
Throws:
java.lang.Exception

getCompoundDocumentState

public static java.lang.String getCompoundDocumentState(org.w3c.dom.Document propertiesXML)
                                                 throws java.lang.Exception
Returns the top level classdesc id or null if not found.

Parameters:
propertiesXML - XML Document that contains the document properties
Returns:
A string representing compound document state
Throws:
java.lang.Exception

getFolderName

public java.lang.String getFolderName(org.w3c.dom.Document propsDoc,
                                      WcmWorkplaceConfig config)
                               throws java.lang.Exception
Returns the folder name using the site preferences.

Parameters:
propsDoc - XML Document that contains the folder name.
config - Workplace configuration.
Returns:
A string representing the folder name
Throws:
java.lang.Exception

getCustomObjectName

public java.lang.String getCustomObjectName(org.w3c.dom.Document propsDoc,
                                            WcmWorkplaceConfig config)
                                     throws java.lang.Exception
Returns the custom object name using the site preferences.

Parameters:
propsDoc - XML Document that contains the custom object name.
config - Workplace configuration.
Returns:
A string representing the folder name
Throws:
java.lang.Exception

getDocumentName

public java.lang.String getDocumentName(org.w3c.dom.Document propsDoc,
                                        WcmWorkplaceConfig config)
                                 throws java.lang.Exception
Returns the document name using the site preferences.

Parameters:
propsDoc - XML Document that contains the document name.
config - Workplace configuration.
Returns:
A string representing the document name
Throws:
java.lang.Exception

isEndNode

public boolean isEndNode(org.w3c.dom.Document choicesDoc,
                         java.lang.String selectedID)
                  throws java.lang.Exception
Use this method to determine if the selected ID represents an end node.

Parameters:
choicesDoc - The choice list XML.
selectedID - The id of the currently selected choice.
Returns:
boolean value that indicates if the selectedID represents an end node.
Throws:
java.lang.Exception

addPropValues

public org.w3c.dom.Document addPropValues(org.w3c.dom.Document outputDoc,
                                          org.w3c.dom.Document propDescsDoc,
                                          java.lang.String symname,
                                          java.lang.String[] values,
                                          java.util.Locale locale)
                                   throws java.lang.Exception
Add the given values to the Document property with the given id.

Parameters:
outputDoc - The XML Document to add values to.
propDescsDoc - The property descriptions XML.
symname - The id of the property to add the values to.
values - The array of values to add.
Returns:
The XML Document that the values were added to.
Throws:
java.lang.Exception

moveUp

public org.w3c.dom.Document moveUp(org.w3c.dom.Document outputDoc,
                                   org.w3c.dom.Document propDescsDoc,
                                   java.lang.String symname,
                                   java.lang.String[] sMove,
                                   java.util.Locale locale)
                            throws java.lang.Exception
Move the selected items up in the list

Parameters:
outputDoc - The XML Document to change.
propDescsDoc - The property descriptions XML to retrieve the choices from.
symname - The Symbolic Name of the property to change.
sMove - The array of values to move up.
Returns:
The XML Document that was changed.
Throws:
java.lang.Exception

moveUp

public java.lang.String[] moveUp(java.lang.String[] sArray,
                                 java.lang.String[] sMove)
                          throws java.lang.Exception
The actual work part of moving elements up in an array

Parameters:
sArray - The original array
sMove - The array of items to move
Returns:
The rearranged array or null if unchanged
Throws:
java.lang.Exception

moveDown

public org.w3c.dom.Document moveDown(org.w3c.dom.Document outputDoc,
                                     org.w3c.dom.Document propDescsDoc,
                                     java.lang.String symname,
                                     java.lang.String[] sMove,
                                     java.util.Locale locale)
                              throws java.lang.Exception
Moves the selected items down in the list.

Parameters:
outputDoc - The XML Document to change.
propDescsDoc - The property descriptions XML.
symname - The Symbolic Name of the property to change.
sMove - The array of values to move down.
Returns:
The XML Document that was changed.
Throws:
java.lang.Exception

moveDown

public java.lang.String[] moveDown(java.lang.String[] sArray,
                                   java.lang.String[] sMove)
                            throws java.lang.Exception
The actual work part of moving elements down in an array

Parameters:
sArray - The original array
sMove - The array of items to move
Returns:
The rearranged array or null if unchanged
Throws:
java.lang.Exception

addAllPropValues

public org.w3c.dom.Document addAllPropValues(org.w3c.dom.Document outputDoc,
                                             org.w3c.dom.Document propDescsDoc,
                                             java.lang.String symname,
                                             int cvlSize,
                                             java.util.Locale locale)
                                      throws java.lang.Exception
Adds all of the indicated prop values from the choice list to the output XML.

Parameters:
outputDoc - The XML Document to change.
propDescsDoc - The property descriptions XML to retrieve the choices from.
symname - The Symbolic Name of the property to change.
Returns:
The XML Document that was changed.
Throws:
java.lang.Exception

validate

public java.util.ArrayList validate(org.w3c.dom.Document outputDoc,
                                    org.w3c.dom.Document propDescsDoc,
                                    boolean isFolder,
                                    java.util.Locale locale,
                                    java.lang.String moduleName,
                                    com.filenet.wcm.toolkit.server.base.WcmController controller)
                             throws java.lang.Exception
Checks the output XML Document to validate each entered value and to see if all of the required properties have been filled. It also makes sure the class allows instances to be created and that there are no required properties whose values cannot be set.

Parameters:
outputDoc - The output XML document.
propDescsDoc - The property descriptions XML document.
isFolder - Indicates if object is a folder.
controller - Controller
moduleName - Module name
Returns:
Always returns true if no Exception is thrown.
Throws:
com.filenet.wcm.toolkit.util.WcmException - Thrown when a required property is not set.
java.lang.Exception

testFolderChars

public void testFolderChars(java.lang.String chars,
                            java.util.Locale locale,
                            java.lang.String symName,
                            java.lang.String propName,
                            java.util.ArrayList exceptions)
                     throws java.lang.Exception
Throws:
java.lang.Exception

validate

public java.lang.String validate(org.w3c.dom.Document propDescsDoc,
                                 java.lang.String symName,
                                 java.lang.String dataType,
                                 java.lang.String propVal,
                                 java.util.Locale locale,
                                 java.util.TimeZone tz)
                          throws java.lang.Exception
Rudimentary validation of the given property value using the given property description.

Parameters:
propDescsDoc - The XML Document that contains the property descriptions.
symName - The Symbolic name of the Property to validate.
dataType - The Data Type of the Property to validate.
propVal - The value to validate.
locale - The Locale
Returns:
The validated property value.
Throws:
java.lang.Exception

addDefaultValues

public org.w3c.dom.Document addDefaultValues(org.w3c.dom.Document outputDoc,
                                             org.w3c.dom.Document propDescsDoc,
                                             java.lang.String symName,
                                             java.util.Locale locale)
                                      throws java.lang.Exception
Adds the default values to a newly created output XML buffer.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML.
symName - The symbolic name of the property being working on.
Returns:
A new document with the default values loaded.
Throws:
java.lang.Exception

updatePropValues

public boolean updatePropValues(org.w3c.dom.Document outputDoc,
                                org.w3c.dom.Document propDescsDoc,
                                org.w3c.dom.Document valuesDoc,
                                java.lang.String symbolicName,
                                java.util.Locale locale)
                         throws java.lang.Exception
Updates the Document property with the given values.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML Document.
valuesDoc - The values to update with.
symbolicName - The symname of the property being worked on.
Returns:
A boolean indicating if the property was updated.
Throws:
java.lang.Exception

updatePropChoice

public boolean updatePropChoice(org.w3c.dom.Document outputDoc,
                                org.w3c.dom.Document propDescsDoc,
                                org.w3c.dom.Document choicesDoc,
                                java.lang.String symName,
                                java.lang.String choiceID,
                                java.util.Locale locale)
                         throws java.lang.Exception
Updates the Document property choice with the given choice id value.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML Document.
choicesDoc - The Choice list XML Document.
symName - The Symbolic Name of the property we are working on.
choiceID - The ID of the choice list.
Returns:
A boolean indicating if the property was updated.
Throws:
java.lang.Exception

updateProps

public boolean updateProps(org.w3c.dom.Document outputDoc,
                           org.w3c.dom.Document propDescsDoc,
                           javax.servlet.http.HttpServletRequest request,
                           java.util.Locale locale,
                           com.filenet.wcm.toolkit.server.base.WcmController controller,
                           java.lang.String moduleName)
                    throws java.lang.Exception
Updates the Document with values returned in the request object.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML Document.
request - The HttpServletRequest object.
Returns:
A boolean indicating if the properties were changed.
Throws:
java.lang.Exception

updateProps

public boolean updateProps(org.w3c.dom.Document outputDoc,
                           org.w3c.dom.Document propDescsDoc,
                           javax.servlet.http.HttpServletRequest request,
                           java.util.Locale locale,
                           java.lang.String prefix,
                           com.filenet.wcm.toolkit.server.base.WcmController controller,
                           java.lang.String moduleName)
                    throws java.lang.Exception
Updates the Document with values returned in the request object.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML Document.
request - The HttpServletRequest object.
prefix - Variable name prefix. This allow same symname with different prefix
Returns:
A boolean indicating if the properties were changed.
Throws:
java.lang.Exception

updateProp

public boolean updateProp(org.w3c.dom.Document outputDoc,
                          org.w3c.dom.Document propDescsDoc,
                          java.lang.String prefix,
                          java.lang.String symName,
                          javax.servlet.http.HttpServletRequest request,
                          java.util.Locale locale)
                   throws java.lang.Exception
Updates the Document with values returned in the request object.

Parameters:
outputDoc - The output XML Document.
propDescsDoc - The property descriptions XML Document.
request - The HttpServletRequest object.
Returns:
A boolean indicating if the properties were changed.
Throws:
java.lang.Exception

initializeClientProps

public boolean initializeClientProps(org.w3c.dom.Document output,
                                     org.w3c.dom.Document propertyDescriptions,
                                     javax.servlet.http.HttpServletRequest request,
                                     java.util.Map propertyValues,
                                     com.filenet.wcm.toolkit.server.base.WcmController controller)
                              throws java.lang.Exception
For AppInt/Client modes.

Parameters:
output - The output XML Document.
propertyDescriptions - The property descriptions XML Document.
request - The HttpServletRequest object.
propertyValues - Map containing the property symname/values from the command xml.
controller - WcmController object
Returns:
A boolean indicating if the properties were changed.
Throws:
java.lang.Exception

updateDocClass

public org.w3c.dom.Document updateDocClass(org.w3c.dom.Document outputDoc,
                                           org.w3c.dom.Document docClasses,
                                           java.lang.String sID)
                                    throws java.lang.Exception
Updates the DocClass with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
docClasses - The Document classes XML Document.
sID - The ID Of the docClass to use.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

updateCustomObjectClass

public org.w3c.dom.Document updateCustomObjectClass(org.w3c.dom.Document outputDoc,
                                                    org.w3c.dom.Document customObjectClasses,
                                                    java.lang.String sID)
                                             throws java.lang.Exception
Updates the CustomOBjectClass with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
customObjectClasses - The Document classes XML Document.
sID - The ID Of the docClass to use.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

updateLinkClass

public org.w3c.dom.Document updateLinkClass(org.w3c.dom.Document outputDoc,
                                            org.w3c.dom.Document linkClasses,
                                            java.lang.String ID)
                                     throws java.lang.Exception
Updates the Link class with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
linkClasses - The Link classes XML Document.
ID - The ID Of the Link Class to use.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

updateFolderClass

public org.w3c.dom.Document updateFolderClass(org.w3c.dom.Document outputDoc,
                                              org.w3c.dom.Document folderClasses,
                                              java.lang.String sID)
                                       throws java.lang.Exception
Update the folderClass with the folder Class with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
folderClasses - The Folder classes XML Document.
sID - The ID of the folder Class to use.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

updateSecurityPolicyClass

public org.w3c.dom.Document updateSecurityPolicyClass(org.w3c.dom.Document outputDoc,
                                                      org.w3c.dom.Document securityPolicyClasses,
                                                      java.lang.String sID)
                                               throws java.lang.Exception
Updates the SecurityPolicyClass with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
securityPolicyClasses - The Document classes XML Document.
sID - The ID Of the docClass to use.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

updateComponentRelationshipClass

public org.w3c.dom.Document updateComponentRelationshipClass(org.w3c.dom.Document outputDoc,
                                                             org.w3c.dom.Document relationshipClass)
                                                      throws java.lang.Exception
Updates the Component Relationship class with the indicated sID

Parameters:
outputDoc - The output XML Document to update.
relationshipClass - The Link classes XML Document.
Returns:
The output XML Document that was updated.
Throws:
java.lang.Exception

openExceptionPage

public static void openExceptionPage(java.util.List exceptions,
                                     com.filenet.wcm.toolkit.server.base.WcmController controller,
                                     java.lang.String moduleName)
                              throws java.lang.Exception
Opens a popup window with the exceptions displayed

Parameters:
moduleName - module name.
controller - controller object
exceptions - ArrayList object holding the list of exceptions
Throws:
java.lang.Exception

openExceptionPage

public static void openExceptionPage(java.util.List exceptions,
                                     com.filenet.wcm.toolkit.server.base.WcmController controller,
                                     java.lang.String moduleName,
                                     boolean isPopUp,
                                     java.lang.String pageTitle,
                                     java.lang.String returnUrl)
                              throws java.lang.Exception
Opens a popup window with the exceptions displayed

Parameters:
moduleName - module name.
controller - controller object
exceptions - ArrayList object holding the list of exceptions
Throws:
java.lang.Exception

openExceptionPage

public void openExceptionPage(com.filenet.wcm.toolkit.util.WcmException exception,
                              com.filenet.wcm.toolkit.server.base.WcmController controller,
                              java.lang.String moduleName)
                       throws java.lang.Exception
Opens a popup window with the exceptions displayed

Parameters:
moduleName - module name.
controller - controller object
exception - exception object
Throws:
java.lang.Exception


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.