Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-436

Create an enumerated DocumentAction class for document actions (edit, view, download, etc)

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Minor
    • None
    • 1.0 B5
    • Model
    • None
    • patch
    • Awaiting Contributor feedback

    Description

      Right now actions are strings retrieved with: "String XWikiContext.getAction()". This leads to:

      • hardcoded strings in several places in the code. 23 occurrences for "download", 186 for "view", etc.
      • fragile code. For example the code in ZipExplorerPlugin does: filename = getFileLocationFromZipURL(url, context.getAction().trim()); This is because there's always a risk of a white space somewhere...

      I propose to create a DocumentAction class and to have DocumentAction XWikiContext.getAction(). The DocumentAction class would be implemented either using the commons-lang Enumerated model or using the model followed by Cargo. For example: http://fisheye.codehaus.org/browse/cargo/cargo/trunk/core/api/container/src/main/java/org/codehaus/cargo/container/ContainerType.java?r=987

      Attachments

        Issue Links

          Activity

            People

              sdumitriu Sergiu Dumitriu
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: