org.sakaiproject.tool.content
Class ResourcesAction

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.sakaiproject.vm.ComponentServlet
              extended byorg.sakaiproject.vm.VmServlet
                  extended byorg.sakaiproject.cheftool.VmServlet
                      extended byorg.sakaiproject.cheftool.ToolServlet
                          extended byorg.sakaiproject.cheftool.VelocityPortletPaneledAction
                              extended byorg.sakaiproject.cheftool.PagedResourceHelperAction
                                  extended byorg.sakaiproject.tool.content.ResourcesAction
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class ResourcesAction
extends PagedResourceHelperAction

ResourceAction is a ContentHosting application

Version:
$Revision: 7328 $
Author:
University of Michigan, CHEF Software Development Team
See Also:
Serialized Form

Nested Class Summary
static class ResourcesAction.AttachItem
           
static class ResourcesAction.BrowseItem
          Internal class that encapsulates all information about a resource that is needed in the browse mode
static class ResourcesAction.EditItem
          Inner class encapsulates information about resources (folders and items) for editing
static class ResourcesAction.ElementCarrier
           
static class ResourcesAction.MetadataGroup
          inner class encapsulates information about groups of metadata tags (such as DC, LOM, etc.)
static class ResourcesAction.PathItem
          Inner class encapsulates information about folders (and final item?)
static class ResourcesAction.SaveArtifactAttempt
           
 
Nested classes inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
VelocityPortletPaneledAction.MyLogger
 
Field Summary
static Integer CARDINALITY_MULTIPLE
          A constant indicating any the number of attachments is unlimited.
static Integer CARDINALITY_SINGLE
          A constant indicating maximum of one item can be attached.
static String COPYRIGHT_PATH
          copyright path -- MUST have same value as AccessServlet.COPYRIGHT_PATH
protected static int DEFAULT_PAGE_SIZE
          The default number of site collections per page.
protected static int EXPANDABLE_FOLDER_SIZE_LIMIT
          The number of members for a collection at which this tool should refuse to expand the collection
static String MIME_TYPE_STRUCTOBJ
           
static String MODE_ATTACHMENT_CONFIRM
           
static String MODE_ATTACHMENT_CONFIRM_INIT
           
static String MODE_ATTACHMENT_CREATE
           
static String MODE_ATTACHMENT_CREATE_INIT
           
static String MODE_ATTACHMENT_DONE
           
static String MODE_ATTACHMENT_EDIT_ITEM
           
static String MODE_ATTACHMENT_EDIT_ITEM_INIT
           
static String MODE_ATTACHMENT_NEW_ITEM
           
static String MODE_ATTACHMENT_NEW_ITEM_INIT
           
static String MODE_ATTACHMENT_SELECT
          modes for attachment helper
static String MODE_ATTACHMENT_SELECT_INIT
           
static String MODE_HELPER
           
protected static String PARAM_PAGESIZE
           
static String RESOURCES_MODE_DROPBOX
           
static String RESOURCES_MODE_HELPER
           
static String RESOURCES_MODE_RESOURCES
          portlet configuration parameter values
static boolean SHOW_ALL_SITES_IN_FILE_PICKER
          The default value for whether to show all sites in file-picker (used if global value can't be read from server config service)
static String STATE_ATTACH_CARDINALITY
          The name of the state attribute for the maximum number of items to attach.
static String STATE_ATTACH_COLLECTION_ID
          The name of the optional state attribute indicating the id of the collection that should be treated as the "home" collection
static String STATE_ATTACH_FORM_FIELD
          The name of the state attribute indicating which form field a resource should be attached to
static String STATE_ATTACH_FORM_ID
          The name of the state attribute for "new-item" attachment indicating the id of the form-type if item-type is TYPE_FORM (ignored otherwise)
static String STATE_ATTACH_INSTRUCTION
          The name of the state attribute for the instructions when a tool uses Resources as attachment helper (for create or attach but not for edit mode)
static String STATE_ATTACH_ITEM_ID
          The name of the state attribute for "new-item" attachment indicating the id of the item to edit
static String STATE_ATTACH_LINKS
          The name of the state attribute indicating that the file picker should return links to existing resources in an existing collection rather than copying it to the hidden attachments area.
static String STATE_ATTACH_TEXT
          The name of the state attribute for "new-item" attachment indicating the type of item
static String STATE_ATTACH_TITLE
          The name of the state attribute for the title when a tool uses Resources as attachment helper (for create or attach but not for edit mode)
static String STATE_ATTACH_TOOL_NAME
          The name of the state attribute containing the name of the tool that invoked Resources as attachment helper
static String STATE_ATTACHMENTS
          State attribute for the Vector of References, one for each attachment.
static String STATE_CREATE_COLLECTION_ID
           
static String STATE_CREATE_NUMBER
           
static String STATE_CREATE_TYPE
           
static String STATE_EDIT_COLLECTION_ID
           
static String STATE_EDIT_ID
          The edit id
static String STATE_FROM_TEXT
          The part of the message after "Attachments for:", set by the client tool.
static String STATE_HAS_ATTACHMENT_BEFORE
          State attribute for where there is at least one attachment before invoking attachment tool
static String STATE_HELPER_CANCELED_BY_USER
          the name of the state attribute indicating that the user canceled out of the helper.
protected static String STATE_HIGHLIGHTED_ITEMS
           
static String STATE_MODE_RESOURCES
          The resources, helper or dropbox mode.
protected static String STATE_REMOVED_ATTACHMENTS
           
static String STATE_RESOURCE_FILTER
          State Attribute for the org.sakaiproject.service.legacy.content.ContentResourceFilter object that the current filter should honor.
static String STATE_RESOURCES_HELPER_MODE
          The resources, helper or dropbox mode.
static String STATE_SAVE_ATTACHMENT_IN_DROPBOX
          The name of the state attribute indicating which dropbox(es) the items should be saved in
static String STATE_SHOW_ALL_SITES
          The name of a state attribute indicating whether the resources tool/helper is allowed to show all sites the user has access to
protected static String STATE_SHOW_COPY_ACTION
           
protected static String STATE_SHOW_MOVE_ACTION
           
static String STATE_SHOW_OTHER_SITES
          The name of a state attribute indicating whether the wants to see other sites if that is enabled
protected static String STATE_SHOW_REMOVE_ACTION
           
static String STATE_STACK_CREATE_COLLECTION_ID
           
static String STATE_STACK_CREATE_NUMBER
           
static String STATE_STACK_CREATE_TYPE
           
static String STATE_STACK_EDIT_COLLECTION_ID
           
static String STATE_STACK_EDIT_ID
           
static String STATE_STACK_STRUCTOBJ_TYPE
           
static String STATE_STACK_STRUCTOBJ_TYPE_READONLY
           
static String STATE_STRUCTOBJ_TYPE
           
static String STATE_STRUCTOBJ_TYPE_READONLY
           
static String STATE_SUSPENDED_OPERATIONS_STACK
          the create contexts
static String STATE_SUSPENDED_OPERATIONS_STACK_DEPTH
           
protected static String STATE_TOP_MESSAGE_INDEX
           
static String TYPE_FOLDER
           
static String TYPE_FORM
           
static String TYPE_HTML
           
static String TYPE_TEXT
           
static String TYPE_UPLOAD
           
static String TYPE_URL
           
 
Fields inherited from class org.sakaiproject.cheftool.PagedResourceHelperAction
FORM_SEARCH, STATE_GO_FIRST_PAGE, STATE_GO_LAST_PAGE, STATE_GO_NEXT, STATE_GO_NEXT_PAGE, STATE_GO_PREV, STATE_GO_PREV_PAGE, STATE_MANUAL_REFRESH, STATE_NEXT_EXISTS, STATE_NEXT_PAGE_EXISTS, STATE_NUM_MESSAGES, STATE_PAGESIZE, STATE_PREV_EXISTS, STATE_PREV_PAGE_EXISTS, STATE_SEARCH, STATE_TOP_PAGE_MESSAGE, STATE_VIEW_ID
 
Fields inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
ATTR_CONFIG, ATTR_CONTEXT, ATTR_FRAME_FOCUS, ATTR_FRAME_REFRESH, ATTR_PORTLET, ATTR_RUNDATA, ATTR_TOP_REFRESH, BUTTON, CONTEXT_SITE_COLLECTION_ID, CONTEXT_SITE_COLLECTION_URL, LAYOUT_MAIN, Log, MODE_OPTIONS, STATE_ACTION, STATE_FLOAT, STATE_HELPER, STATE_MESSAGE, STATE_MODE, STATE_OBSERVER, STATE_OBSERVER2, STATE_PRESENCE_OBSERVER, STATE_TOOL
 
Fields inherited from class org.sakaiproject.cheftool.ToolServlet
ALERT_ATTR, ALERT_STATE_INITED, MENU_ATTR, PARAM_ACTION, PARAM_ACTION_COMBO, TITLE_PANEL, TOOL_MODE_ATTR, TOOL_MODE_DEFAULT
 
Fields inherited from class org.sakaiproject.cheftool.VmServlet
m_validator
 
Fields inherited from class org.sakaiproject.vm.ComponentServlet
ATTR_PARAMS
 
Constructor Summary
ResourcesAction()
           
 
Method Summary
protected static boolean addInstance(String field, List properties)
          Search a flat list of ResourcesMetadata properties for one whose localname matches "field".
static void attachItem(String itemId, SessionState state)
           
static void attachLink(String itemId, SessionState state)
           
static String buildCreateContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for creating folders and items
 String buildDeleteConfirmContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for delete confirmation page
static String buildEditContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context to edit the editable list of resource properties
static String buildHelperContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for the helper view
static String buildItemTypeContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
           
 String buildListContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for the list view
 String buildMainPanelContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for normal display
static String buildMoreContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context to show the list of resource properties
 String buildOptionsPanelContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Setup for customization
static String buildSelectAttachmentContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for selecting attachments
 String buildWebdavContext(VelocityPortlet portlet, Context context, RunData data, SessionState state)
          Build the context for add display
protected static void captureMultipleValues(SessionState state, ParameterParser params, boolean markMissing)
          Retrieve values for one or more items from create context.
protected static void capturePropertyValues(ParameterParser params, ResourcesAction.EditItem item, List properties)
           
static Set captureValues(ResourcesAction.EditItem item, int index, SessionState state, ParameterParser params, boolean markMissing)
          Retrieve from an html form all the values needed to create a new resource
protected static void captureValues(SessionState state, ParameterParser params)
          Retrieve values for an item from edit context.
protected static boolean checkItemFilter(ContentResource resource, ResourcesAction.BrowseItem newItem, SessionState state)
           
protected static boolean checkSelctItemFilter(ContentResource resource, SessionState state)
           
protected static void createFiles(SessionState state)
          Add a new file to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS.
protected static void createFolders(SessionState state)
          Add a new folder to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS.
protected static void createUrls(SessionState state)
          Add a new URL to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS.
static void doAddattachments(RunData data)
           
static void doAttachitem(RunData data)
           
static void doAttachupload(RunData data)
           
static void doAttachurl(RunData data)
           
 void doCancel_options(RunData data, Context context)
          doCancel_options called for form input tags type="submit" named="eventSubmit_doCancel" cancel the options process
static void doCancel(RunData data)
          doCancel to return to the previous state
static void doCollapse_collection(RunData data)
          Remove the collection id from the expanded collection list
 void doConfigure_update(RunData data, Context context)
          Handle the configure context's update button
 void doCopy(RunData data)
          set the state name to be "copy" if any item has been selected for copying
 void doCopyitem(RunData data)
          set the state name to be "copy" if any item has been selected for copying
static void doCreate(RunData data)
          initiate creation of one or more resource items (folders, file uploads, html docs, text docs, or urls) default type is folder
static void doCreateitem(RunData data)
           
 void doCut(RunData data)
          set the state name to be "cut" if any item has been selected for cutting
 void doDelete(RunData data)
          doDelete to delete the selected collection or resource items
 void doDeleteconfirm(RunData data)
          set the state name to be "deletecofirm" if any item has been selected for deleting
static void doEdit(RunData data)
          Edit the editable collection/resource properties
static void doExpand_collection(RunData data)
          Add the collection id into the expanded collection list
static void doExpandall(RunData data)
          Expand all the collection resources.
 void doFolder_permissions(RunData data, Context context)
          Fire up the permissions editor for the current folder's permissions
 void doHandlepaste(RunData data)
          Paste the previously copied/cutted item(s)
 void doHandlepasteshortcut(RunData data)
          Paste the shortcut(s) of previously copied item(s)
static void doHide_metadata(RunData data)
           
static void doHideOtherSites(RunData data)
           
static void doInsertValue(RunData data)
          Process user's request to add an instance of a particular field to a structured object.
 void doList(RunData data)
          Expand all the collection resources and put in EXPANDED_COLLECTIONS attribute.
static void doMore(RunData data)
          show the resource properties
 void doMove(RunData data)
          Handle user's selection of items to be moved.
static void doMoveitems(RunData data)
          Paste the item(s) selected to be moved
static void doNavigate(RunData data)
          Navigate in the resource hireachy
static void doPasteitem(RunData data)
          Paste the previously copied item(s)
static void doPasteitems(RunData data)
          Paste the previously copied item(s)
 void doPermissions(RunData data, Context context)
          Fire up the permissions editor for the tool's permissions
static void doRemoveitem(RunData data)
           
static void doSavechanges(RunData data)
          Modify the properties
static void doShow_metadata(RunData data)
           
 void doShow_webdav(RunData data)
          Show information about WebDAV
static void doShowOtherSites(RunData data)
           
static void doSort(RunData data)
          Sort based on the given property
protected static void doToggle_intent(RunData data)
           
static void doUnexpandall(RunData data)
          Unexpand all the collection resources
protected static int findResourceInList(List resources, String id)
          Find the resource with this id in the list.
protected static List getBrowseItems(String collectionId, HashMap expandedCollections, Set highlightedItems, String sortedBy, String sortedAsc, ResourcesAction.BrowseItem parent, boolean isLocal, SessionState state)
          Get the items in this folder that should be seen.
static List getCollectionPath(SessionState state)
           
static ResourcesAction.EditItem getEditItem(String id, String collectionId, RunData data)
           
static void importStructuredArtifact(Node node, ResourcesMetadata property)
          This method captures property values from an org.w3c.dom.Document and inserts them into a hierarchical list of ResourcesMetadata objects which describes the structure of the form.
protected  void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData data)
          Populate the state object, if needed - override to do something!
static void initStateAttributes(SessionState state, VelocityPortlet portlet)
           
protected  boolean notificationEnabled(SessionState state)
          is notification enabled?
protected static List prepPage(SessionState state)
          Prepare the current page of site collections to display.
protected static List readAllResources(SessionState state)
          Develop a list of all the site collections that there are to page.
protected  void setCopyFlags(SessionState state)
          If copy-flag is set to false, erase the copied-id's list and set copied flags to false in all the browse items.
static void setupStructuredObjects(SessionState state)
          This method updates the session state with information needed to create or modify structured artifacts in the resources tool.
protected static String validateURL(String url)
           
 
Methods inherited from class org.sakaiproject.cheftool.PagedResourceHelperAction
addListPagingMenus, addRefreshMenus, addSearchMenus, addViewPagingMenus, doAuto, doChange_pagesize, doList_first, doList_last, doList_next, doList_prev, doRefresh, doSearch_clear, doSearch, doView_next, doView_prev, enableObserver, resetPaging
 
Methods inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
actionDispatch, addAlert, addOptionsMenu, cancelOptions, clientWindowId, disableObservers, doGet, doOptions, doReset, enableObservers, getContext, helperActionDispatch, initState, justDelivered, mainPanelUpdateId, processAction, resetTool, saveOptions, scheduleFocusRefresh, schedulePeerFrameRefresh, scheduleTopRefresh, setVmCourier, setVmStdRef, titlePanelUpdateId, toolModeDispatch, updateState
 
Methods inherited from class org.sakaiproject.cheftool.ToolServlet
doPost, getAlert, getAlert, getMenu, getPid, getState, getToolMode, prepState, setToolMode
 
Methods inherited from class org.sakaiproject.vm.VmServlet
getActionURL, getVmReference, includeVm, setVmReference
 
Methods inherited from class org.sakaiproject.vm.ComponentServlet
sendParentRedirect, service, setNoCacheHeaders
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_MODE_RESOURCES

public static final String STATE_MODE_RESOURCES
The resources, helper or dropbox mode.

See Also:
Constant Field Values

STATE_RESOURCES_HELPER_MODE

public static final String STATE_RESOURCES_HELPER_MODE
The resources, helper or dropbox mode.

See Also:
Constant Field Values

STATE_SHOW_ALL_SITES

public static final String STATE_SHOW_ALL_SITES
The name of a state attribute indicating whether the resources tool/helper is allowed to show all sites the user has access to

See Also:
Constant Field Values

STATE_SHOW_OTHER_SITES

public static final String STATE_SHOW_OTHER_SITES
The name of a state attribute indicating whether the wants to see other sites if that is enabled

See Also:
Constant Field Values

COPYRIGHT_PATH

public static final String COPYRIGHT_PATH
copyright path -- MUST have same value as AccessServlet.COPYRIGHT_PATH

See Also:
Constant Field Values

STATE_EDIT_ID

public static final String STATE_EDIT_ID
The edit id

See Also:
Constant Field Values

STATE_STACK_EDIT_ID

public static final String STATE_STACK_EDIT_ID
See Also:
Constant Field Values

STATE_EDIT_COLLECTION_ID

public static final String STATE_EDIT_COLLECTION_ID
See Also:
Constant Field Values

STATE_STACK_EDIT_COLLECTION_ID

public static final String STATE_STACK_EDIT_COLLECTION_ID
See Also:
Constant Field Values

STATE_SUSPENDED_OPERATIONS_STACK

public static final String STATE_SUSPENDED_OPERATIONS_STACK
the create contexts

See Also:
Constant Field Values

STATE_SUSPENDED_OPERATIONS_STACK_DEPTH

public static final String STATE_SUSPENDED_OPERATIONS_STACK_DEPTH
See Also:
Constant Field Values

STATE_CREATE_TYPE

public static final String STATE_CREATE_TYPE
See Also:
Constant Field Values

STATE_CREATE_COLLECTION_ID

public static final String STATE_CREATE_COLLECTION_ID
See Also:
Constant Field Values

STATE_CREATE_NUMBER

public static final String STATE_CREATE_NUMBER
See Also:
Constant Field Values

STATE_STRUCTOBJ_TYPE

public static final String STATE_STRUCTOBJ_TYPE
See Also:
Constant Field Values

STATE_STRUCTOBJ_TYPE_READONLY

public static final String STATE_STRUCTOBJ_TYPE_READONLY
See Also:
Constant Field Values

STATE_STACK_CREATE_TYPE

public static final String STATE_STACK_CREATE_TYPE
See Also:
Constant Field Values

STATE_STACK_CREATE_COLLECTION_ID

public static final String STATE_STACK_CREATE_COLLECTION_ID
See Also:
Constant Field Values

STATE_STACK_CREATE_NUMBER

public static final String STATE_STACK_CREATE_NUMBER
See Also:
Constant Field Values

STATE_STACK_STRUCTOBJ_TYPE

public static final String STATE_STACK_STRUCTOBJ_TYPE
See Also:
Constant Field Values

STATE_STACK_STRUCTOBJ_TYPE_READONLY

public static final String STATE_STACK_STRUCTOBJ_TYPE_READONLY
See Also:
Constant Field Values

MIME_TYPE_STRUCTOBJ

public static final String MIME_TYPE_STRUCTOBJ
See Also:
Constant Field Values

TYPE_FOLDER

public static final String TYPE_FOLDER
See Also:
Constant Field Values

TYPE_UPLOAD

public static final String TYPE_UPLOAD
See Also:
Constant Field Values

TYPE_URL

public static final String TYPE_URL
See Also:
Constant Field Values

TYPE_FORM

public static final String TYPE_FORM
See Also:
Constant Field Values

TYPE_HTML

public static final String TYPE_HTML
See Also:
Constant Field Values

TYPE_TEXT

public static final String TYPE_TEXT
See Also:
Constant Field Values

STATE_ATTACHMENTS

public static final String STATE_ATTACHMENTS
State attribute for the Vector of References, one for each attachment. Using tools can pre-populate, and can read the results from here.

See Also:
Constant Field Values

STATE_RESOURCE_FILTER

public static final String STATE_RESOURCE_FILTER
State Attribute for the org.sakaiproject.service.legacy.content.ContentResourceFilter object that the current filter should honor. If this is set to null, then all files will be selectable and viewable

See Also:
Constant Field Values

STATE_HAS_ATTACHMENT_BEFORE

public static final String STATE_HAS_ATTACHMENT_BEFORE
State attribute for where there is at least one attachment before invoking attachment tool

See Also:
Constant Field Values

STATE_FROM_TEXT

public static final String STATE_FROM_TEXT
The part of the message after "Attachments for:", set by the client tool.

See Also:
Constant Field Values

STATE_HELPER_CANCELED_BY_USER

public static final String STATE_HELPER_CANCELED_BY_USER
the name of the state attribute indicating that the user canceled out of the helper. Is set only if the user canceled out of the helper.

See Also:
Constant Field Values

STATE_SAVE_ATTACHMENT_IN_DROPBOX

public static final String STATE_SAVE_ATTACHMENT_IN_DROPBOX
The name of the state attribute indicating which dropbox(es) the items should be saved in

See Also:
Constant Field Values

STATE_ATTACH_COLLECTION_ID

public static final String STATE_ATTACH_COLLECTION_ID
The name of the optional state attribute indicating the id of the collection that should be treated as the "home" collection

See Also:
Constant Field Values

STATE_ATTACH_LINKS

public static final String STATE_ATTACH_LINKS
The name of the state attribute indicating that the file picker should return links to existing resources in an existing collection rather than copying it to the hidden attachments area. If this value is not set, all attachments are to copies in the hidden attachments area.

See Also:
Constant Field Values

STATE_ATTACH_TITLE

public static final String STATE_ATTACH_TITLE
The name of the state attribute for the title when a tool uses Resources as attachment helper (for create or attach but not for edit mode)

See Also:
Constant Field Values

STATE_ATTACH_INSTRUCTION

public static final String STATE_ATTACH_INSTRUCTION
The name of the state attribute for the instructions when a tool uses Resources as attachment helper (for create or attach but not for edit mode)

See Also:
Constant Field Values

STATE_ATTACH_TOOL_NAME

public static final String STATE_ATTACH_TOOL_NAME
The name of the state attribute containing the name of the tool that invoked Resources as attachment helper

See Also:
Constant Field Values

STATE_ATTACH_TEXT

public static final String STATE_ATTACH_TEXT
The name of the state attribute for "new-item" attachment indicating the type of item

See Also:
Constant Field Values

STATE_ATTACH_ITEM_ID

public static final String STATE_ATTACH_ITEM_ID
The name of the state attribute for "new-item" attachment indicating the id of the item to edit

See Also:
Constant Field Values

STATE_ATTACH_FORM_ID

public static final String STATE_ATTACH_FORM_ID
The name of the state attribute for "new-item" attachment indicating the id of the form-type if item-type is TYPE_FORM (ignored otherwise)

See Also:
Constant Field Values

STATE_ATTACH_FORM_FIELD

public static final String STATE_ATTACH_FORM_FIELD
The name of the state attribute indicating which form field a resource should be attached to

See Also:
Constant Field Values

STATE_ATTACH_CARDINALITY

public static final String STATE_ATTACH_CARDINALITY
The name of the state attribute for the maximum number of items to attach. The attribute value will be an Integer, usually CARDINALITY_SINGLE or CARDINALITY_MULTIPLE.

See Also:
Constant Field Values

CARDINALITY_SINGLE

public static final Integer CARDINALITY_SINGLE
A constant indicating maximum of one item can be attached.


CARDINALITY_MULTIPLE

public static final Integer CARDINALITY_MULTIPLE
A constant indicating any the number of attachments is unlimited.


MODE_HELPER

public static final String MODE_HELPER
See Also:
Constant Field Values

MODE_ATTACHMENT_SELECT

public static final String MODE_ATTACHMENT_SELECT
modes for attachment helper

See Also:
Constant Field Values

MODE_ATTACHMENT_CREATE

public static final String MODE_ATTACHMENT_CREATE
See Also:
Constant Field Values

MODE_ATTACHMENT_NEW_ITEM

public static final String MODE_ATTACHMENT_NEW_ITEM
See Also:
Constant Field Values

MODE_ATTACHMENT_EDIT_ITEM

public static final String MODE_ATTACHMENT_EDIT_ITEM
See Also:
Constant Field Values

MODE_ATTACHMENT_CONFIRM

public static final String MODE_ATTACHMENT_CONFIRM
See Also:
Constant Field Values

MODE_ATTACHMENT_SELECT_INIT

public static final String MODE_ATTACHMENT_SELECT_INIT
See Also:
Constant Field Values

MODE_ATTACHMENT_CREATE_INIT

public static final String MODE_ATTACHMENT_CREATE_INIT
See Also:
Constant Field Values

MODE_ATTACHMENT_NEW_ITEM_INIT

public static final String MODE_ATTACHMENT_NEW_ITEM_INIT
See Also:
Constant Field Values

MODE_ATTACHMENT_EDIT_ITEM_INIT

public static final String MODE_ATTACHMENT_EDIT_ITEM_INIT
See Also:
Constant Field Values

MODE_ATTACHMENT_CONFIRM_INIT

public static final String MODE_ATTACHMENT_CONFIRM_INIT
See Also:
Constant Field Values

MODE_ATTACHMENT_DONE

public static final String MODE_ATTACHMENT_DONE
See Also:
Constant Field Values

SHOW_ALL_SITES_IN_FILE_PICKER

public static final boolean SHOW_ALL_SITES_IN_FILE_PICKER
The default value for whether to show all sites in file-picker (used if global value can't be read from server config service)

See Also:
Constant Field Values

EXPANDABLE_FOLDER_SIZE_LIMIT

protected static final int EXPANDABLE_FOLDER_SIZE_LIMIT
The number of members for a collection at which this tool should refuse to expand the collection

See Also:
Constant Field Values

STATE_SHOW_REMOVE_ACTION

protected static final String STATE_SHOW_REMOVE_ACTION
See Also:
Constant Field Values

STATE_SHOW_MOVE_ACTION

protected static final String STATE_SHOW_MOVE_ACTION
See Also:
Constant Field Values

STATE_SHOW_COPY_ACTION

protected static final String STATE_SHOW_COPY_ACTION
See Also:
Constant Field Values

STATE_HIGHLIGHTED_ITEMS

protected static final String STATE_HIGHLIGHTED_ITEMS
See Also:
Constant Field Values

DEFAULT_PAGE_SIZE

protected static final int DEFAULT_PAGE_SIZE
The default number of site collections per page.

See Also:
Constant Field Values

PARAM_PAGESIZE

protected static final String PARAM_PAGESIZE
See Also:
Constant Field Values

STATE_TOP_MESSAGE_INDEX

protected static final String STATE_TOP_MESSAGE_INDEX
See Also:
Constant Field Values

STATE_REMOVED_ATTACHMENTS

protected static final String STATE_REMOVED_ATTACHMENTS
See Also:
Constant Field Values

RESOURCES_MODE_RESOURCES

public static final String RESOURCES_MODE_RESOURCES
portlet configuration parameter values

See Also:
Constant Field Values

RESOURCES_MODE_DROPBOX

public static final String RESOURCES_MODE_DROPBOX
See Also:
Constant Field Values

RESOURCES_MODE_HELPER

public static final String RESOURCES_MODE_HELPER
See Also:
Constant Field Values
Constructor Detail

ResourcesAction

public ResourcesAction()
Method Detail

createFolders

protected static void createFolders(SessionState state)
Add a new folder to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS. The number of items to be added is indicated by the state attribute named STATE_STACK_CREATE_NUMBER, and the items are added to the collection identified by the state attribute named STATE_STACK_CREATE_COLLECTION_ID.

Parameters:
state -

buildMainPanelContext

public String buildMainPanelContext(VelocityPortlet portlet,
                                    Context context,
                                    RunData data,
                                    SessionState state)
Build the context for normal display


buildListContext

public String buildListContext(VelocityPortlet portlet,
                               Context context,
                               RunData data,
                               SessionState state)
Build the context for the list view


buildHelperContext

public static String buildHelperContext(VelocityPortlet portlet,
                                        Context context,
                                        RunData data,
                                        SessionState state)
Build the context for the helper view


buildItemTypeContext

public static String buildItemTypeContext(VelocityPortlet portlet,
                                          Context context,
                                          RunData data,
                                          SessionState state)

buildSelectAttachmentContext

public static String buildSelectAttachmentContext(VelocityPortlet portlet,
                                                  Context context,
                                                  RunData data,
                                                  SessionState state)
Build the context for selecting attachments


doList

public void doList(RunData data)
Expand all the collection resources and put in EXPANDED_COLLECTIONS attribute.


buildWebdavContext

public String buildWebdavContext(VelocityPortlet portlet,
                                 Context context,
                                 RunData data,
                                 SessionState state)
Build the context for add display


buildDeleteConfirmContext

public String buildDeleteConfirmContext(VelocityPortlet portlet,
                                        Context context,
                                        RunData data,
                                        SessionState state)
Build the context for delete confirmation page


buildMoreContext

public static String buildMoreContext(VelocityPortlet portlet,
                                      Context context,
                                      RunData data,
                                      SessionState state)
Build the context to show the list of resource properties


buildEditContext

public static String buildEditContext(VelocityPortlet portlet,
                                      Context context,
                                      RunData data,
                                      SessionState state)
Build the context to edit the editable list of resource properties


doNavigate

public static void doNavigate(RunData data)
Navigate in the resource hireachy


doShow_webdav

public void doShow_webdav(RunData data)
Show information about WebDAV


doCreate

public static void doCreate(RunData data)
initiate creation of one or more resource items (folders, file uploads, html docs, text docs, or urls) default type is folder


doCreateitem

public static void doCreateitem(RunData data)
Parameters:
data -

createFiles

protected static void createFiles(SessionState state)
Add a new file to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS. The number of items to be added is indicated by the state attribute named STATE_STACK_CREATE_NUMBER, and the items are added to the collection identified by the state attribute named STATE_STACK_CREATE_COLLECTION_ID.

Parameters:
state -

doInsertValue

public static void doInsertValue(RunData data)
Process user's request to add an instance of a particular field to a structured object.

Parameters:
data -

addInstance

protected static boolean addInstance(String field,
                                     List properties)
Search a flat list of ResourcesMetadata properties for one whose localname matches "field". If found and the field can have additional instances, increment the count for that item.

Parameters:
field -
properties -
Returns:
true if the field is found, false otherwise.

doAttachitem

public static void doAttachitem(RunData data)

doAttachupload

public static void doAttachupload(RunData data)

doAttachurl

public static void doAttachurl(RunData data)

doRemoveitem

public static void doRemoveitem(RunData data)

doAddattachments

public static void doAddattachments(RunData data)

attachItem

public static void attachItem(String itemId,
                              SessionState state)

attachLink

public static void attachLink(String itemId,
                              SessionState state)

createUrls

protected static void createUrls(SessionState state)
Add a new URL to ContentHosting for each EditItem in the state attribute named STATE_STACK_CREATE_ITEMS. The number of items to be added is indicated by the state attribute named STATE_STACK_CREATE_NUMBER, and the items are added to the collection identified by the state attribute named STATE_STACK_CREATE_COLLECTION_ID.

Parameters:
state -

buildCreateContext

public static String buildCreateContext(VelocityPortlet portlet,
                                        Context context,
                                        RunData data,
                                        SessionState state)
Build the context for creating folders and items


doMore

public static void doMore(RunData data)
show the resource properties


doDelete

public void doDelete(RunData data)
doDelete to delete the selected collection or resource items


doCancel

public static void doCancel(RunData data)
doCancel to return to the previous state


doHandlepaste

public void doHandlepaste(RunData data)
Paste the previously copied/cutted item(s)


doHandlepasteshortcut

public void doHandlepasteshortcut(RunData data)
Paste the shortcut(s) of previously copied item(s)


doEdit

public static void doEdit(RunData data)
Edit the editable collection/resource properties


getEditItem

public static ResourcesAction.EditItem getEditItem(String id,
                                                   String collectionId,
                                                   RunData data)

setupStructuredObjects

public static void setupStructuredObjects(SessionState state)
This method updates the session state with information needed to create or modify structured artifacts in the resources tool. Among other things, it obtains a list of "forms" available to the user and places that list in state indexed as "STATE_STRUCTOBJ_HOMES". If the current formtype is known (in state indexed as "STATE_STACK_STRUCTOBJ_TYPE"), the list of properties associated with that form type is generated. If we are in a "create" context, the properties are added to each of the items in the list of items indexed as "STATE_STACK_CREATE_ITEMS". If we are in an "edit" context, the properties are added to the current item being edited (a state attribute indexed as "STATE_STACK_EDIT_ITEM"). The metaobj SchemaBean associated with the current form and its root SchemaNode object are also placed in state for later reference.


importStructuredArtifact

public static void importStructuredArtifact(Node node,
                                            ResourcesMetadata property)
This method captures property values from an org.w3c.dom.Document and inserts them into a hierarchical list of ResourcesMetadata objects which describes the structure of the form. The values are added by inserting nested instances into the properties.


validateURL

protected static String validateURL(String url)
                             throws MalformedURLException
Throws:
MalformedURLException

captureValues

protected static void captureValues(SessionState state,
                                    ParameterParser params)
Retrieve values for an item from edit context. Edit context contains just one item at a time of a known type (folder, file, text document, structured-artifact, etc). This method retrieves the data apppropriate to the type and updates the values of the EditItem stored as the STATE_STACK_EDIT_ITEM attribute in state.

Parameters:
state -
params -

captureValues

public static Set captureValues(ResourcesAction.EditItem item,
                                int index,
                                SessionState state,
                                ParameterParser params,
                                boolean markMissing)
Retrieve from an html form all the values needed to create a new resource

Parameters:
item - The EditItem object in which the values are temporarily stored.
index - The index of the item (used as a suffix in the name of the form element)
state -
params -
markMissing - Indicates whether to mark required elements if they are missing.
Returns:

captureMultipleValues

protected static void captureMultipleValues(SessionState state,
                                            ParameterParser params,
                                            boolean markMissing)
Retrieve values for one or more items from create context. Create context contains up to ten items at a time all of the same type (folder, file, text document, structured-artifact, etc). This method retrieves the data apppropriate to the type and updates the values of the EditItem objects stored as the STATE_STACK_CREATE_ITEMS attribute in state. If the third parameter is "true", missing/incorrect user inputs will generate error messages and attach flags to the input elements.

Parameters:
state -
params -
markMissing - Should this method generate error messages and add flags for missing/incorrect user inputs?

capturePropertyValues

protected static void capturePropertyValues(ParameterParser params,
                                            ResourcesAction.EditItem item,
                                            List properties)

doSavechanges

public static void doSavechanges(RunData data)
Modify the properties


doToggle_intent

protected static void doToggle_intent(RunData data)
Parameters:
data -

doHideOtherSites

public static void doHideOtherSites(RunData data)
Parameters:
data -

doShowOtherSites

public static void doShowOtherSites(RunData data)
Parameters:
data -

doHide_metadata

public static void doHide_metadata(RunData data)
Parameters:
data -

doShow_metadata

public static void doShow_metadata(RunData data)
Parameters:
data -

doSort

public static void doSort(RunData data)
Sort based on the given property


doDeleteconfirm

public void doDeleteconfirm(RunData data)
set the state name to be "deletecofirm" if any item has been selected for deleting


doCut

public void doCut(RunData data)
set the state name to be "cut" if any item has been selected for cutting


doCopy

public void doCopy(RunData data)
set the state name to be "copy" if any item has been selected for copying


doMove

public void doMove(RunData data)
Handle user's selection of items to be moved.


setCopyFlags

protected void setCopyFlags(SessionState state)
If copy-flag is set to false, erase the copied-id's list and set copied flags to false in all the browse items. If copied-id's list is empty, set copy-flag to false and set copied flags to false in all the browse items. If copy-flag is set to true and copied-id's list is not empty, update the copied flags of all browse items so copied flags for the copied items are set to true and all others are set to false.


doExpandall

public static void doExpandall(RunData data)
Expand all the collection resources.


doUnexpandall

public static void doUnexpandall(RunData data)
Unexpand all the collection resources


initState

protected void initState(SessionState state,
                         VelocityPortlet portlet,
                         JetspeedRunData data)
Populate the state object, if needed - override to do something!

Overrides:
initState in class PagedResourceHelperAction

initStateAttributes

public static void initStateAttributes(SessionState state,
                                       VelocityPortlet portlet)

buildOptionsPanelContext

public String buildOptionsPanelContext(VelocityPortlet portlet,
                                       Context context,
                                       RunData data,
                                       SessionState state)
Setup for customization


doConfigure_update

public void doConfigure_update(RunData data,
                               Context context)
Handle the configure context's update button


doCancel_options

public void doCancel_options(RunData data,
                             Context context)
doCancel_options called for form input tags type="submit" named="eventSubmit_doCancel" cancel the options process


doExpand_collection

public static void doExpand_collection(RunData data)
                                throws IdUnusedException,
                                       TypeException,
                                       PermissionException
Add the collection id into the expanded collection list

Throws:
PermissionException
TypeException
IdUnusedException

doCollapse_collection

public static void doCollapse_collection(RunData data)
Remove the collection id from the expanded collection list


getCollectionPath

public static List getCollectionPath(SessionState state)
Parameters:
state -
Returns:

getBrowseItems

protected static List getBrowseItems(String collectionId,
                                     HashMap expandedCollections,
                                     Set highlightedItems,
                                     String sortedBy,
                                     String sortedAsc,
                                     ResourcesAction.BrowseItem parent,
                                     boolean isLocal,
                                     SessionState state)
Get the items in this folder that should be seen.

Parameters:
collectionId - - String version of
expandedCollections - - Hash of collection resources
sortedBy - - pass through to ContentHostingComparator
sortedAsc - - pass through to ContentHostingComparator
parent - - The folder containing this item
isLocal - - true if navigation root and home collection id of site are the same, false otherwise
state - - The session state
Returns:
a List of BrowseItem objects

checkItemFilter

protected static boolean checkItemFilter(ContentResource resource,
                                         ResourcesAction.BrowseItem newItem,
                                         SessionState state)

checkSelctItemFilter

protected static boolean checkSelctItemFilter(ContentResource resource,
                                              SessionState state)

doCopyitem

public void doCopyitem(RunData data)
set the state name to be "copy" if any item has been selected for copying


doPasteitems

public static void doPasteitems(RunData data)
Paste the previously copied item(s)


doMoveitems

public static void doMoveitems(RunData data)
Paste the item(s) selected to be moved


doPasteitem

public static void doPasteitem(RunData data)
Paste the previously copied item(s)


doFolder_permissions

public void doFolder_permissions(RunData data,
                                 Context context)
Fire up the permissions editor for the current folder's permissions


doPermissions

public void doPermissions(RunData data,
                          Context context)
Fire up the permissions editor for the tool's permissions


notificationEnabled

protected boolean notificationEnabled(SessionState state)
is notification enabled?


readAllResources

protected static List readAllResources(SessionState state)
Develop a list of all the site collections that there are to page. Sort them as appropriate, and apply search criteria.


prepPage

protected static List prepPage(SessionState state)
Prepare the current page of site collections to display.

Returns:
List of BrowseItem objects to display on this page.

findResourceInList

protected static int findResourceInList(List resources,
                                        String id)
Find the resource with this id in the list.

Parameters:
id - The message id.
Returns:
The index position in the list of the message with this id, or -1 if not found.