Package org.bgerp.app.servlet.file

# Class Files

java.lang.Object
org.bgerp.app.servlet.file.Files

public class Files extends Object
Files accessor, allowing to see and remove directory files.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Files(Class<? extends BaseAction> actionClass, String id, String basedir, Options options, String... wildcards)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DynActionForm`
  `delete(DynActionForm form)`
  Delete file(s)
  `org.apache.struts.action.ActionForward`
  `download(DynActionForm form)`
  Sends a file content to response output stream
  `String`
  `getDeletePermissionAction()`
  File deletion permission action for checking it using ctxUser.checkPerm().
  `String`
  `getDeleteURL()`
  File deletion URL, e.g.: '/admin/app.do?method=deleteLogUpdate'.
  `String`
  `getDownloadPermissionAction()`
  File download permission action for checking it using ctxUser.checkPerm().
  `String`
  `getDownloadURL()`
  File download URL, e.g.: '/admin/app.do?method=downloadLogUpdate'.
  `String`
  `getHighlightPermissionAction()`
  `String`
  `getHighlightURL()`
  `String`
  `getId()`
  Unique string ID of the files set.
  `Options`
  `getOptions()`
  Options.
  `DynActionForm`
  `highlight(DynActionForm form)`
  Set a file highlight classes to a response
  `List<File>`
  `list()`
  List of files matching
  invalid reference

      #wildcard

  sorted accordingly `Options.getOrder()`
  `long`
  `size(List<File> files)`
  Calculates total size of provided files.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Files

    public Files(Class<? extends BaseAction> actionClass, String id, String basedir, Options options, String... wildcards)
    Constructor
    Parameters:
      `actionClass` - the linked action class
      `id` - unique ID of the files
      `basedir` - base dir, only the files there are shown
      `options` - extended possibilities
      `wildcards` - wildcards for filtering files, '*' is supported

- ## Method Details

  - ### getId

    public String getId()
    Unique string ID of the files set. Used for generation action names.
    Returns:

  - ### getOptions

    public Options getOptions()
    Options.
    Returns:

  - ### getDownloadPermissionAction

    public String getDownloadPermissionAction()
    File download permission action for checking it using ctxUser.checkPerm().
    Returns:

  - ### getDownloadURL

    public String getDownloadURL()
    File download URL, e.g.: '/admin/app.do?method=downloadLogUpdate'. A `name` param has to be added at the end.
    Returns:

  - ### getHighlightPermissionAction

    public String getHighlightPermissionAction()

  - ### getHighlightURL

    public String getHighlightURL()

  - ### getDeletePermissionAction

    public String getDeletePermissionAction()
    File deletion permission action for checking it using ctxUser.checkPerm().
    Returns:

  - ### getDeleteURL

    public String getDeleteURL()
    File deletion URL, e.g.: '/admin/app.do?method=deleteLogUpdate'. A `name` param has to be added at the end.
    Returns:

  - ### list

    public List<File> list()
    List of files matching
    invalid reference

        #wildcard

    sorted accordingly `Options.getOrder()`
    Returns:

  - ### size

    public long size(List<File> files)
    Calculates total size of provided files.
    Parameters:
      `files` - list of files to sum
    Returns:
      total size in bytes

  - ### download

    public org.apache.struts.action.ActionForward download(DynActionForm form) throws BGIllegalArgumentException, IOException, FileNotFoundException
    Sends a file content to response output stream
    Parameters:
      `form` - request form with file name in param `name`
    Returns:
      always `null`
    Throws:
      `BGIllegalArgumentException`
      `IOException`
      `FileNotFoundException`

  - ### highlight

    public DynActionForm highlight(DynActionForm form) throws BGIllegalArgumentException, FileNotFoundException
    Set a file highlight classes to a response
    Parameters:
      `form` - the request form with the file name in param `name`
    Returns:
    Throws:
      `BGIllegalArgumentException`
      `FileNotFoundException`

  - ### delete

    public DynActionForm delete(DynActionForm form)
    Delete file(s)
    Parameters:
      `form` - form with `name` parameter values, containing the file name(s)
    Returns:
      the `form`