Package org.silverpeas.components.silvercrawler.control

## Class SilverCrawlerSessionController

- java.lang.Object
- - org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
  - - org.silverpeas.components.silvercrawler.control.SilverCrawlerSessionController

- All Implemented Interfaces:
    `Serializable`, `org.silverpeas.core.web.mvc.controller.ComponentSessionController`, `org.silverpeas.core.web.session.SessionCloseable`

      public class SilverCrawlerSessionController
      extends org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

      `context`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SilverCrawlerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)` | Standard Session Controller Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `UploadReport` | `checkLastUpload()` | Checks upload info coming from DragNDrop.
    `boolean` | `checkRWSettingsAccess​(boolean throwException)` | Only people with admin profil AND listed in silverpeas configuration are allowed to set read/write access
    `boolean` | `checkUserLANAccess​(String remoteIPAdress)` |
    `void` | `createFolder​(String newName)` |
    `FileFolder` | `getCurrentFolder()` |
    `FileFolder` | `getCurrentFolder​(boolean isAdmin)` |
    `String` | `getCurrentPath()` |
    `Collection<FileDetail>` | `getCurrentResultSearch()` |
    `Collection<HistoryByUser>` | `getHistoryByFolder​(String folderName)` |
    `Collection<HistoryByUser>` | `getHistoryByFolderFromResult​(String folderName)` |
    `Collection<HistoryDetail>` | `getHistoryByUser​(String folderName, String userId)` |
    `UploadReport` | `getLastUploadReport()` |
    `String` | `getNameFromPath​(String path)` |
    `String` | `getNbMaxDirectoriesByPage()` |
    `String` | `getNbMaxFilesByPage()` |
    `Collection<String>` | `getPath()` |
    `Collection<FileDetail>` | `getResultSearch​(String word)` |
    `String` | `getRootPath()` |
    `void` | `goToDirectory​(String directory)` |
    `void` | `indexFile​(String fileName)` |
    `void` | `indexPath​(String folderName)` |
    `void` | `indexPathSelected​(Collection<String> dirToIndex)` |
    `void` | `indexSelectedFiles​(Collection<String> fileToIndex)` |
    `Boolean` | `isAllowedNav()` |
    `Boolean` | `isDownload()` |
    `boolean` | `isReadWriteActivated()` | Is read//write access has been activated
    `boolean` | `isRootPath()` |
    `UploadReport` | `processLastUpload()` | Processes the files upload by copying the uploaded files by DragAndDrop from the temporary repository to the current folder.
    `void` | `removeFile​(String fileName, boolean isAdminOrPublisher)` |
    `void` | `removeSubFolder​(String folderName, boolean isAdmin)` | Remove the given subfolder.
    `void` | `renameFolder​(String folderName, String newName)` |
    `void` | `resetLastUploadReport()` | Reset any existing upload report and clean temp folder if exists.
    `void` | `saveFile​(org.silverpeas.core.util.file.FileItem fileItem, boolean replaceFile)` |
    `void` | `setCurrentPath​(String path)` |
    `void` | `setCurrentPathFromResult​(String path)` |
    `void` | `setLastUploadReport​(UploadReport report)` |
    `void` | `setRootPath()` |
    `void` | `switchReadWriteAccess​(boolean active)` | Enable/disable read//write access.
    `void` | `unindexFile​(String fileName)` |
    `void` | `unindexPath​(String folderName)` |
    `FolderZIPInfo` | `zipFolder​(String folderName)` |

    - ### Methods inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

      `addClipboardSelection, clipboardPasteDone, close, getClipboardErrorMessage, getClipboardExceptionError, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getHighestSilverpeasUserRole, getIcon, getLanguage, getLook, getMultilang, getOrganisationController, getPersonalization, getRSSUrl, getSelection, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserDetail, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoles, getZoneId, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardSelectedElement, setComponentRootName, setSpaceModeMaintenance`

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

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

- - ### Constructor Detail

    - #### SilverCrawlerSessionController

          public SilverCrawlerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl,
                                                org.silverpeas.core.web.mvc.controller.ComponentContext componentContext)

      Standard Session Controller Constructor
      Parameters:
        `mainSessionCtrl` - The user's profile
        `componentContext` - The component's profile

  - ### Method Detail

    - #### getCurrentFolder

          public FileFolder getCurrentFolder​(boolean isAdmin)

    - #### getCurrentFolder

          public FileFolder getCurrentFolder()

    - #### isRootPath

          public boolean isRootPath()

    - #### setRootPath

          public void setRootPath()

    - #### getNbMaxDirectoriesByPage

          public String getNbMaxDirectoriesByPage()

    - #### getNbMaxFilesByPage

          public String getNbMaxFilesByPage()

    - #### goToDirectory

          public void goToDirectory​(String directory)

    - #### isDownload

          public Boolean isDownload()

    - #### isAllowedNav

          public Boolean isAllowedNav()

    - #### setCurrentPath

          public void setCurrentPath​(String path)

    - #### setCurrentPathFromResult

          public void setCurrentPathFromResult​(String path)

    - #### getNameFromPath

          public String getNameFromPath​(String path)

    - #### getCurrentPath

          public String getCurrentPath()

    - #### getPath

          public Collection<String> getPath()

    - #### zipFolder

          public FolderZIPInfo zipFolder​(String folderName)

    - #### getHistoryByFolder

          public Collection<HistoryByUser> getHistoryByFolder​(String folderName)

    - #### getHistoryByFolderFromResult

          public Collection<HistoryByUser> getHistoryByFolderFromResult​(String folderName)

    - #### getHistoryByUser

          public Collection<HistoryDetail> getHistoryByUser​(String folderName,
                                                            String userId)

    - #### unindexPath

          public void unindexPath​(String folderName)

    - #### unindexFile

          public void unindexFile​(String fileName)

    - #### indexPath

          public void indexPath​(String folderName)

    - #### indexFile

          public void indexFile​(String fileName)

    - #### indexPathSelected

          public void indexPathSelected​(Collection<String> dirToIndex)

    - #### indexSelectedFiles

          public void indexSelectedFiles​(Collection<String> fileToIndex)

    - #### getResultSearch

          public Collection<FileDetail> getResultSearch​(String word)

    - #### getCurrentResultSearch

          public Collection<FileDetail> getCurrentResultSearch()

    - #### getRootPath

          public String getRootPath()

    - #### isReadWriteActivated

          public boolean isReadWriteActivated()

      Is read//write access has been activated
      Returns:
        true only if is activated both in platform and component instance

    - #### switchReadWriteAccess

          public void switchReadWriteAccess​(boolean active)
                                     throws SilverCrawlerForbiddenActionException

      Enable/disable read//write access.
      Parameters:
        `active` - true to activate read/write access
      Throws:
        `SilverCrawlerForbiddenActionException` - if the user can change the read/write access.

    - #### checkRWSettingsAccess

          public boolean checkRWSettingsAccess​(boolean throwException)
                                        throws SilverCrawlerForbiddenActionException

      Only people with admin profil AND listed in silverpeas configuration are allowed to set read/write access
      Parameters:
        `throwException` - true if exception must be thrown if checks failed. (else just return false)
      Throws:
        `SilverCrawlerForbiddenActionException` - if user doesn't have those requirements.

    - #### removeSubFolder

          public void removeSubFolder​(String folderName,
                                      boolean isAdmin)
                               throws SilverCrawlerForbiddenActionException

      Remove the given subfolder.
      Parameters:
        `folderName` - name of folder to be removed
        `isAdmin` - flag to indicate if user has admin profile
      Throws:
        `SilverCrawlerForbiddenActionException` - if the deletion is forbidden or cannot be done.

    - #### renameFolder

          public void renameFolder​(String folderName,
                                   String newName)
                            throws SilverCrawlerFolderRenameException,
                                   IOException

      Throws:
        `SilverCrawlerFolderRenameException`
        `IOException`

    - #### createFolder

          public void createFolder​(String newName)
                            throws SilverCrawlerFolderCreationException

      Throws:
        `SilverCrawlerFolderCreationException`

    - #### removeFile

          public void removeFile​(String fileName,
                                 boolean isAdminOrPublisher)
                          throws SilverCrawlerForbiddenActionException

      Throws:
        `SilverCrawlerForbiddenActionException`

    - #### saveFile

          public void saveFile​(org.silverpeas.core.util.file.FileItem fileItem,
                               boolean replaceFile)
                        throws SilverCrawlerFileUploadException

      Throws:
        `SilverCrawlerFileUploadException`

    - #### setLastUploadReport

          public void setLastUploadReport​(UploadReport report)

    - #### getLastUploadReport

          public UploadReport getLastUploadReport()

    - #### checkLastUpload

          public UploadReport checkLastUpload()

      Checks upload info coming from DragNDrop. Uses UploadReport to retrieves folders/files list and detect conflicts
      Returns:
        an upload report

    - #### processLastUpload

          public UploadReport processLastUpload()

      Processes the files upload by copying the uploaded files by DragAndDrop from the temporary repository to the current folder.
      Returns:
        a report about the upload process.

    - #### resetLastUploadReport

          public void resetLastUploadReport()

      Reset any existing upload report and clean temp folder if exists.

    - #### checkUserLANAccess

          public boolean checkUserLANAccess​(String remoteIPAdress)