com.filenet.wcm.apps.server.util.compounddocument
Class CompoundDocumentUtil

java.lang.Object
  extended bycom.filenet.wcm.apps.server.util.compounddocument.CompoundDocumentUtil

public class CompoundDocumentUtil
extends java.lang.Object

Utility class to support getting attachment information for the eProcess page.


Field Summary
static java.lang.String EMPTY_XML
          Empty XML String
 
Method Summary
static boolean canEditCompoundDocument(WcmSitePrefs sitePrefs, com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, java.lang.String objectStoreName, java.lang.String classId)
           
static com.filenet.wcm.apps.server.presentation.util.ActionDefinition getAddChildAction(AccessRoles accessRoles)
           
static com.filenet.api.collection.IndependentObjectSet getChildComponentRelationships(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, java.lang.String objectStoreName, java.lang.String parentId, boolean ascending, int maxElements)
          Queries the server for the component relationships and theirs assocated child documents.
static org.w3c.dom.Document getChildDocumentsXML(java.util.List crList, int pageSize, int currentPage, java.lang.String titleProperty)
          Returns the child document XML used in rendering the child document list view.
static java.lang.String getChoiceName(org.w3c.dom.Document choiceXML, java.lang.String value)
          Helper method to look up the name of a choice list item given its value.
static java.util.Map getClassDescriptionMap(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, CompoundDocumentObjectStorePrefs cdObjectStorePrefs)
          Gets a map of the API class description objects using on the classes defined by the compound document object store pref.
static java.lang.String getClassId(com.filenet.api.core.ComponentRelationship cr)
           
static java.util.List getComponentRelationshipList(CompoundDocumentState cdState)
          Returns a list of ComponentRelationshipRef objects for the current page of the child document list view.
static org.w3c.dom.Document getComponentRelationshipPropertiesXML(org.w3c.dom.Document propDescXML, ComponentRelationshipRef crRef)
           
static org.w3c.dom.Document getComponentRelationshipPropertiesXML(org.w3c.dom.Document propDescsXML, org.w3c.dom.Document propertiesXML)
           
static ComponentRelationshipRef getComponentRelationshipRef(com.filenet.api.core.ComponentRelationship cr)
          Creates and returns a new ComponentRelationshipRef object.
static ComponentRelationshipRef getComponentRelationshipRef(org.w3c.dom.Document propDescXML, CompoundDocumentPrefs cdPref, com.filenet.api.core.ComponentRelationship cr)
          Creates and returns a new ComponentRelationshipRef object.
static org.w3c.dom.Document getComponentRelationshipsXML(java.util.List crList, int pageSize, int currentPage, java.util.Locale locale)
          Returns the component relationship XML used in rendering the child document list view.
static int getItemIndex(CompoundDocumentState cdState, int index)
          Gets the item list index given the xml item position.
static ComponentRelationshipRef getLastComponentRelationshipObjectRef(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, java.lang.String objectStoreName, java.lang.String parentId)
          Queries the server the last component relationship object in the selected compound document.
static int getLinkToType(ComponentRelationshipRef crRef)
          Helper method to get the Link To type.
static java.lang.String getObjectStoreName(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, java.lang.String objectStoreIndentifier)
           
static java.util.List getParentComponentRelationshipList(CompoundDocumentState cdState)
          Returns a list of ComponentRelationshipRef objects for the current page of the parent document list view.
static com.filenet.api.collection.RepositoryRowSet getParentDocuments(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, java.lang.String objectStoreName, java.lang.String childId, java.lang.String titleProperty, java.lang.String orderByProperty, boolean ascending, int maxElements)
          Queries the server for the parentes documents of the specified child document.
static org.w3c.dom.Document getParentDocumentsXML(java.util.List crList, int pageSize, int currentPage, java.lang.String titleProperty)
          Returns the parent document XML used in rendering the parent document list view.
static java.lang.String getStringValue(java.lang.Object value)
           
static java.lang.String lookupClassName(java.util.Map classDescMap, java.lang.String classId)
          Looks up a singe class name.
static int moveDown(CompoundDocumentState cdState, int index)
          Moves the selected item down one position in the compound document structure.
static int moveFirst(CompoundDocumentState cdState, int index)
          Moves the selected item to the first position in the compound document structure.
static int moveLast(CompoundDocumentState cdState, int index)
          Moves the selected item to the last position in the compound document structure.
static int moveUp(CompoundDocumentState cdState, int index)
          Moves the selected item up one position in the compound document structure.
static void reOrderList(CompoundDocumentState cdState, int startingIndex, int startingOrderNumber, int offSet)
          Reorders the component relationship list starting from the specified starting index and starting order number.
static org.apache.commons.collections.map.ListOrderedMap updateComponentRelationshipItems(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, CompoundDocumentState cdState, java.util.Locale locale)
          Helper method for saving data back to the server.
static boolean updateComponentRelationshipItems(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp, WcmAuthoringState authorState, CompoundDocumentState cdState, java.util.Locale locale)
          Helper method for saving changes back to the server for all new, modified, moved or removed component relationship objects within an add document or checkin document wizard.
static boolean validateComponentRelationship(java.util.List exceptionList, ComponentRelationshipRef crRef, java.util.Locale locale)
          Helper method to validate the submitted component relationship data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_XML

public static final java.lang.String EMPTY_XML
Empty XML String

See Also:
Constant Field Values
Method Detail

getComponentRelationshipPropertiesXML

public static org.w3c.dom.Document getComponentRelationshipPropertiesXML(org.w3c.dom.Document propDescXML,
                                                                         ComponentRelationshipRef crRef)
                                                                  throws java.lang.Exception
Throws:
java.lang.Exception

getComponentRelationshipPropertiesXML

public static org.w3c.dom.Document getComponentRelationshipPropertiesXML(org.w3c.dom.Document propDescsXML,
                                                                         org.w3c.dom.Document propertiesXML)
                                                                  throws java.lang.Exception
Throws:
java.lang.Exception

getStringValue

public static java.lang.String getStringValue(java.lang.Object value)

getObjectStoreName

public static java.lang.String getObjectStoreName(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                  java.lang.String objectStoreIndentifier)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getItemIndex

public static int getItemIndex(CompoundDocumentState cdState,
                               int index)
                        throws java.lang.Exception
Gets the item list index given the xml item position.

Parameters:
cdState - The compound document state object.
index - The xml position of the selected component relationship item.
Returns:
int The item index in the componet relationship list.
Throws:
java.lang.Exception

getChildDocumentsXML

public static org.w3c.dom.Document getChildDocumentsXML(java.util.List crList,
                                                        int pageSize,
                                                        int currentPage,
                                                        java.lang.String titleProperty)
                                                 throws java.lang.Exception
Returns the child document XML used in rendering the child document list view.

Parameters:
crList - The list holding the component relationship objects.
pageSize - The current listview page size.
currentPage - The listivew current page.
titleProperty - The title property.
Returns:
Document The child document XML for the selected page.
Throws:
java.lang.Exception - All exceptions.

getComponentRelationshipsXML

public static org.w3c.dom.Document getComponentRelationshipsXML(java.util.List crList,
                                                                int pageSize,
                                                                int currentPage,
                                                                java.util.Locale locale)
                                                         throws java.lang.Exception
Returns the component relationship XML used in rendering the child document list view.

Parameters:
crList - The list holding the component relationship objects.
pageSize - The current listview page size.
currentPage - The listivew current page.
Returns:
Document The component relationship XML for the selected page.
Throws:
java.lang.Exception - All exceptions.

getParentDocumentsXML

public static org.w3c.dom.Document getParentDocumentsXML(java.util.List crList,
                                                         int pageSize,
                                                         int currentPage,
                                                         java.lang.String titleProperty)
                                                  throws java.lang.Exception
Returns the parent document XML used in rendering the parent document list view.

Parameters:
crList - The list holding the component relationship objects.
titleProperty - The title property.
Returns:
Document The child document XML for the selected page.
Throws:
java.lang.Exception - All exceptions.

getComponentRelationshipRef

public static ComponentRelationshipRef getComponentRelationshipRef(com.filenet.api.core.ComponentRelationship cr)
Creates and returns a new ComponentRelationshipRef object. The object will be initialized with properties from the ComponentRelationship object.

Parameters:
cr - ComponentRelationship The API component relationship object.
Returns:
ComponentRelationshipRef The object holding the component relationship data.

getClassId

public static java.lang.String getClassId(com.filenet.api.core.ComponentRelationship cr)

getComponentRelationshipRef

public static ComponentRelationshipRef getComponentRelationshipRef(org.w3c.dom.Document propDescXML,
                                                                   CompoundDocumentPrefs cdPref,
                                                                   com.filenet.api.core.ComponentRelationship cr)
                                                            throws java.lang.Exception
Creates and returns a new ComponentRelationshipRef object. The object will be initialized with properties from the ComponentRelationship object and the property descriptions XML.

Parameters:
cr - ComponentRelationship The API component relationship object.
Returns:
ComponentRelationshipRef The object holding the component relationship data.
Throws:
java.lang.Exception

getChoiceName

public static java.lang.String getChoiceName(org.w3c.dom.Document choiceXML,
                                             java.lang.String value)
                                      throws java.lang.Exception
Helper method to look up the name of a choice list item given its value.

Parameters:
choiceXML - Document The choice list XML.
value - String The choice value.
Returns:
String The choice name.
Throws:
java.lang.Exception - All exception

moveFirst

public static int moveFirst(CompoundDocumentState cdState,
                            int index)
                     throws java.lang.Exception
Moves the selected item to the first position in the compound document structure.

Parameters:
cdState - The compound document state object.
index - The index of the select component relationship object.
Returns:
int The new item index in the componet relationship list.
Throws:
java.lang.Exception

moveUp

public static int moveUp(CompoundDocumentState cdState,
                         int index)
                  throws java.lang.Exception
Moves the selected item up one position in the compound document structure.

Parameters:
cdState - The compound document state object.
index - The index of the select component relationship object.
Returns:
int The new item index in the componet relationship list.
Throws:
java.lang.Exception - All exceptions.

reOrderList

public static void reOrderList(CompoundDocumentState cdState,
                               int startingIndex,
                               int startingOrderNumber,
                               int offSet)
                        throws java.lang.Exception
Reorders the component relationship list starting from the specified starting index and starting order number.

Parameters:
cdState - The compound document state object.
startingIndex - The starting index to begin the reordering.
startingOrderNumber - The starting order nubmer use for reordering.
Throws:
java.lang.Exception - All exceptions

moveDown

public static int moveDown(CompoundDocumentState cdState,
                           int index)
                    throws java.lang.Exception
Moves the selected item down one position in the compound document structure.

Parameters:
cdState - The compound document state object.
index - The index of the select component relationship object.
Returns:
int The new item index in the componet relationship list.
Throws:
java.lang.Exception - All exceptions.

moveLast

public static int moveLast(CompoundDocumentState cdState,
                           int index)
                    throws java.lang.Exception
Moves the selected item to the last position in the compound document structure.

Parameters:
cdState - The compound document state object.
index - The index of the select component relationship object.
Returns:
int The new item index in the componet relationship list.
Throws:
java.lang.Exception - All exceptions.

getChildComponentRelationships

public static com.filenet.api.collection.IndependentObjectSet getChildComponentRelationships(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                                                             java.lang.String objectStoreName,
                                                                                             java.lang.String parentId,
                                                                                             boolean ascending,
                                                                                             int maxElements)
                                                                                      throws java.lang.Exception
Queries the server for the component relationships and theirs assocated child documents.

Parameters:
cddp - CompoundDocumentDataProvider The compound document data provider.
objectStoreName - String The object store name or id.
parentId - String The id of the parent document.
ascending - boolean true to return the component relationship collection back in ascending order based on the component sort order number.
maxElements - int The number of items returned from the query.
Returns:
EngineCollection The collection of engine objects.
Throws:
java.lang.Exception - All exceptions.

getParentDocuments

public static com.filenet.api.collection.RepositoryRowSet getParentDocuments(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                                             java.lang.String objectStoreName,
                                                                             java.lang.String childId,
                                                                             java.lang.String titleProperty,
                                                                             java.lang.String orderByProperty,
                                                                             boolean ascending,
                                                                             int maxElements)
                                                                      throws java.lang.Exception
Queries the server for the parentes documents of the specified child document.

Parameters:
cddp - CompoundDocumentDataProvider The compound document data provider.
objectStoreName - String The object store name or id.
childId - String The id of the child document.
titleProperty - String The document property that is currently displayed as the title of the document by the parent document list view.
orderByProperty - String The property used to order the query result.
ascending - boolean true to return the component relationship collection back in ascending order based on the component sort order number.
maxElements - int The number of items returned from the query.
Returns:
RepositoryRowSet The set of repository rows.
Throws:
java.lang.Exception - All exceptions.

getLastComponentRelationshipObjectRef

public static ComponentRelationshipRef getLastComponentRelationshipObjectRef(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                                             java.lang.String objectStoreName,
                                                                             java.lang.String parentId)
                                                                      throws java.lang.Exception
Queries the server the last component relationship object in the selected compound document.

Parameters:
cddp - CompoundDocumentDataProvider The compound document data provider.
objectStoreName - String The object store name or id.
parentId - String The id of the parent document.
Returns:
ComponentRelationship The last component relationship object in the compound document structure.
Throws:
java.lang.Exception - All exceptions.

getLinkToType

public static int getLinkToType(ComponentRelationshipRef crRef)
Helper method to get the Link To type.

Parameters:
crRef - ComponentRelationshipRef The selected ComponentRelationshipRef object.
Returns:
int The Link To type based on the current component relationship type.

getComponentRelationshipList

public static java.util.List getComponentRelationshipList(CompoundDocumentState cdState)
                                                   throws java.lang.Exception
Returns a list of ComponentRelationshipRef objects for the current page of the child document list view.

Parameters:
cdState - CompoundDocumentState The compound document state object.
Returns:
List A list of ComponentRelationshipRef objects for the current list view page.
Throws:
java.lang.Exception - All exceptions

getParentComponentRelationshipList

public static java.util.List getParentComponentRelationshipList(CompoundDocumentState cdState)
                                                         throws java.lang.Exception
Returns a list of ComponentRelationshipRef objects for the current page of the parent document list view.

Parameters:
cdState - CompoundDocumentState The compound document state object.
Returns:
List A list of ComponentRelationshipRef objects for the current list view page.
Throws:
java.lang.Exception - All exceptions

validateComponentRelationship

public static boolean validateComponentRelationship(java.util.List exceptionList,
                                                    ComponentRelationshipRef crRef,
                                                    java.util.Locale locale)
Helper method to validate the submitted component relationship data.

Parameters:
exceptionList - List The list contains the invalid properties settings.
crRef - ComponentRelationshipRef The selected ComponentRelationshipRef object.
locale - Locale The client locale.
Returns:
boolean true if the submitted data is valid.

updateComponentRelationshipItems

public static boolean updateComponentRelationshipItems(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                       WcmAuthoringState authorState,
                                                       CompoundDocumentState cdState,
                                                       java.util.Locale locale)
                                                throws java.lang.Exception
Helper method for saving changes back to the server for all new, modified, moved or removed component relationship objects within an add document or checkin document wizard. This wil be done in an update batch where all updates are done in one server call. The user will automatically be redirected to an error page when one ore more items fail to update.

Parameters:
cddp - CompoundDocumentDataProvider The compound document data provider.
authorState - WcmAuthoringState The authoring state object.
cdState - CompoundDocumentState The compound document state object.
locale - Locale The client locale.
Returns:
boolean true if nothing failed to update.
Throws:
java.lang.Exception - All exceptions.

updateComponentRelationshipItems

public static org.apache.commons.collections.map.ListOrderedMap updateComponentRelationshipItems(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                                                                 CompoundDocumentState cdState,
                                                                                                 java.util.Locale locale)
                                                                                          throws java.lang.Exception
Helper method for saving data back to the server. This wil be done in an update batch where all updates are done in one server call.

Parameters:
cddp - CompoundDocumentDataProvider The compound document data provider.
cdState - CompoundDocumentState The compound document state object.
locale - Locale The client locale.
Returns:
boolean true if nothing failed to update.
Throws:
java.lang.Exception - All exceptions.

getAddChildAction

public static com.filenet.wcm.apps.server.presentation.util.ActionDefinition getAddChildAction(AccessRoles accessRoles)

canEditCompoundDocument

public static boolean canEditCompoundDocument(WcmSitePrefs sitePrefs,
                                              com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                              java.lang.String objectStoreName,
                                              java.lang.String classId)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getClassDescriptionMap

public static java.util.Map getClassDescriptionMap(com.filenet.wcm.toolkit.server.dp.CompoundDocumentDataProvider cddp,
                                                   CompoundDocumentObjectStorePrefs cdObjectStorePrefs)
                                            throws java.lang.Exception
Gets a map of the API class description objects using on the classes defined by the compound document object store pref.

Returns:
Map A map of class descriptions.
Throws:
java.lang.Exception

lookupClassName

public static java.lang.String lookupClassName(java.util.Map classDescMap,
                                               java.lang.String classId)
                                        throws java.lang.Exception
Looks up a singe class name.

Parameters:
classDescMap - A map of API class description object.
classId - The class id.
Returns:
display name for the specified class. If the class description is not found then returns the id.
Throws:
java.lang.Exception


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