## com.arsdigita.docmgr.ui
Class DMUtils

    java.lang.Object
      com.arsdigita.docmgr.ui.DMUtils

All Implemented Interfaces:
  DMConstants

public class DMUtils
extends Object
implements DMConstants

Public static helper methods and classes for recurring tasks in Document Manager UI.

Author:
  Stefan Deusch

Nested Class Summary
`static class` `DMUtils.DateFormat` Class to render java.util.Date in request specific locale and pattern.
`static class` `DMUtils.FileSize` Class to describe and format file sizes in request specific locales

Field Summary
`static String` `versionId`

Fields inherited from interface com.arsdigita.docmgr.ui.DMConstants

`ABS_PATH, ACTION_COPY_LABEL, ACTION_COPY_SUBMIT, ACTION_COPY_VALUE, ACTION_CUT_LABEL, ACTION_CUT_VALUE, ACTION_DELETE_CONFIRM, ACTION_DELETE_LABEL, ACTION_DELETE_SUBMIT, ACTION_DELETE_VALUE, ACTION_ERROR_CONTINUE, ACTION_ERROR_LABEL, ACTION_MOVE_SUBMIT, BUNDLE_NAME, CANCEL, DESTINATION_FOLDER_PANEL_HEADER, DIFFERENT_MIMETYPE_ERROR, DOCS_XML_NS, EMAIL_INVALID_ERROR, FILE_ACTION_HEADER, FILE_DELETE_CONFIRM, FILE_DELETE_HEADER, FILE_DELETE_LINK, FILE_DESCRIPTION, FILE_DOWNLOAD_HEADER, FILE_DOWNLOAD_LINK, FILE_EDIT_ACTION_DESCRIPTION, FILE_EDIT_HEADER, FILE_EDIT_LINK, FILE_FEEDBACK_HEADER, FILE_ID_PARAM, FILE_ID_PARAM_NAME, FILE_INFO_COMMENTS_TITLE, FILE_INFO_HISTORY_TITLE, FILE_INFO_LABEL, FILE_INFO_LINKS_TITLE, FILE_INFO_PROPERTIES_TITLE, FILE_KEYWORDS, FILE_NAME, FILE_NAME_REQUIRED, FILE_NEW_VERSION_LINK, FILE_PROPERTIES_HEADER, FILE_REVISION_HISTORY_HEADER, FILE_SAVE, FILE_SEND_COLLEAGUE_HEADER, FILE_SEND_COLLEAGUE_LINK, FILE_SOURCE, FILE_SUBMIT, FILE_UPLOAD_ADD_FILE, FILE_UPLOAD_FORM_HEADER, FILE_UPLOAD_HEADER, FILE_UPLOAD_INITIAL_TRANSACTION_DESCRIPTION, FILE_VERSION_DESCRIPTION, FILES, FOLDER_CREATE_FORM_HEADER, FOLDER_DESCRIPTION, FOLDER_DESCRIPTION_LABEL, FOLDER_EMPTY_LABEL, FOLDER_ID, FOLDER_INFORMATION_HEADER, FOLDER_NAME, FOLDER_NAME_LABEL, FOLDER_NEW_FILE_LINK, FOLDER_NEW_FOLDER_LINK, FOLDER_PARENTNOTFOUND_ERROR, FOLDER_SAVE, FOLDERS, GET_ALL_TREES, GET_CHILDREN, GET_REPOSITORIES, GET_REPOSITORIES_ROOTS, GO_BACK_LABEL, HELP_LABEL, IS_FOLDER, IS_LOCKED, IS_MOUNTED, LAST_MODIFIED, MIME_TYPE_LABEL, MODIFYING_USER, MY_WORKSPACE_LABEL, NAME, NUM_FILES, PAGE_TITLE_LABEL, REPOSITORIES_INFORMATION_HEADER, REPOSITORIES_MOUNTED_SAVE, REPOSITORY_ID, REPOSITORY_RECENTDOCS_EMPTY, RESOURCE_EXISTS_ERROR, RESOURCE_ID, ROOT_ADD_DOC_PARAM, ROOT_ADD_DOC_PARAM_NAME, ROOT_ADD_RESOURCE_LINK, ROOTFOLDER_ID_PARAM, ROOTFOLDER_ID_PARAM_NAME, SEL_FOLDER_ID_PARAM, SEL_FOLDER_ID_PARAM_NAME, SEND_FRIEND_FORM_DESCRIPTION, SEND_FRIEND_FORM_EMAIL_LIST, SEND_FRIEND_FORM_EMAIL_SUBJECT, SEND_FRIEND_FORM_SUBMIT, SIGN_OUT_LABEL, SIZE, TYPE, WS_BROWSE_TITLE, WS_REPOSITORIES_TITLE, WS_SEARCH_TITLE`

Constructor Summary
`DMUtils()`

Method Summary
`static String` `extractFileName(String rawName, com.arsdigita.bebop.PageState state)` Extract the true filename from the uploaded filepath name taking OS-specific file-separator into account The considered OS'es are Windows, Mac, and Linux/Unixes.
`static File` `getFile(BigDecimal id)` Attempts to load a file by ID.
`static String` `getFolderName(com.arsdigita.bebop.PageState state, com.arsdigita.bebop.Tree tree)` Get the selected folder in the tree
`static Folder` `getRootFolder(com.arsdigita.bebop.PageState state)` Gets or sets the root folder id and returns the root Folder
`static BigDecimal` `getSelectedFolderID(com.arsdigita.bebop.PageState state, com.arsdigita.bebop.Tree t)` Wrapper to get the selected folder in a tree.
`static BigDecimal` `getSelFolderOrRootID(com.arsdigita.bebop.PageState state, com.arsdigita.bebop.tree.TreeNode n)` Get the selected folder in the tree node or the root tree id
`static com.arsdigita.kernel.User` `getUser(com.arsdigita.bebop.PageState state)` Get User object from request context.
`static void` `setRoot(com.arsdigita.bebop.PageState state, Folder root)` Change global state parameter of root folder.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### versionId

    public static final String versionId

See Also:
  Constant Field Values

Constructor Detail

### DMUtils

    public DMUtils()

Method Detail

### getRootFolder

    public static Folder getRootFolder(com.arsdigita.bebop.PageState state)

  Gets or sets the root folder id and returns the root Folder

### getSelFolderOrRootID

    public static BigDecimal getSelFolderOrRootID(com.arsdigita.bebop.PageState state,
                                                  com.arsdigita.bebop.tree.TreeNode n)

  Get the selected folder in the tree node or the root tree id

### setRoot

    public static void setRoot(com.arsdigita.bebop.PageState state,
                               Folder root)

  Change global state parameter of root folder.

### getUser

    public static com.arsdigita.kernel.User getUser(com.arsdigita.bebop.PageState state)

  Get User object from request context.

### getSelectedFolderID

    public static BigDecimal getSelectedFolderID(com.arsdigita.bebop.PageState state,
                                                 com.arsdigita.bebop.Tree t)

  Wrapper to get the selected folder in a tree. Works only if we are already showing an expanded tree.

### getFile

    public static File getFile(BigDecimal id)

  Attempts to load a file by ID.

### getFolderName

    public static String getFolderName(com.arsdigita.bebop.PageState state,
                                       com.arsdigita.bebop.Tree tree)

  Get the selected folder in the tree

### extractFileName

    public static String extractFileName(String rawName,
                                         com.arsdigita.bebop.PageState state)

  Extract the true filename from the uploaded filepath name taking OS-specific file-separator into account The considered OS'es are Windows, Mac, and Linux/Unixes. The default case is Linux/Unix.

Copyright (c) 2006 Red Hat, Inc. Corporation. All Rights Reserved. Generated at June 1 2006:1113 UTC