Changeset 3923


Ignore:
Timestamp:
Oct 29, 2010, 11:07:17 AM (13 years ago)
Author:
olle
Message:

Refs #714. Code for moving files updated to transfer list of
id values for selected files as a session attribute, in order to
avoid problems when moving many files:

  1. Class/file action/directory/ViewActiveDirectory.java in

client/servlet/ updated:

  1. New valid parameter VInteger VMOVEFILEIDLIST added. It will

be used for the session attribute when transferring file id values.

  1. Protected method void runMe() updated when moving files to set

session attribute coupled to parameter VInteger VMOVEFILEIDLIST
to list of integer id values for seleced files. Previous code adding
file id values as hidden text fields to the directory table has
been removed.

  1. Private method

Table createDirectoryTable(Table templateTable, Directory dir,
Boolean select, Boolean selectMoveDir, Boolean moveFilesMode, Boolean moveFilesStart)
updated by removal of code adding file id values to click action
for directory table.

  1. Class/file action/file/MoveFiles.java in client/servlet/ updated:
  2. Protected method void runMe() updated to retrieve list of

id values for files to move from session attribute
ViewActiveDirectory.VMOVEFILEIDLIST, and to reset the value to
null afterwards.

Location:
trunk/client/servlet/src/org/proteios/action
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/directory/ViewActiveDirectory.java

    r3917 r3923  
    105105    public static final VBoolean VMOVEFILES = new VBoolean("moveFiles", false);
    106106    public static final VBoolean VTABLEUPDATEBUTTONCLICKED = new VBoolean("tableUpdateButtonClicked", false);
     107    public static final VInteger VMOVEFILEIDLIST = new VInteger("active.move.file.id.list", 1, false);
    107108   
    108109    /**
     
    160161                setSessionAttribute(VMOVEFILES, true);
    161162                setSessionAttribute(ForwardField.VPARAM, MoveFiles.class.getName());
     163                setSessionAttribute(VMOVEFILEIDLIST, tmpFileIds);
    162164            }
    163165            else
     
    388390                dirToolbar.setDefaultAction(al);
    389391                dirToolbar.add(al);
    390                 /*
    391                     * Moving several files
    392                 */
    393                 log.debug("moveFilesMode = " + moveFilesMode);
    394                 if (moveFilesMode)
    395                 {
    396                     /*
    397                         * This action may be called several times when
    398                         * navigating from the source to the target directory.
    399                         * First time the id values for selected files are
    400                         * stored in the default valid parameter VInteger ItemIdField.VPARAM,
    401                         * otherwise they are stored in valid parameter VInteger ViewActiveFile.VFILEID.
    402                     */
    403                     List<Integer> tmpFileIds = null;
    404                     // Check if first time when navigating to target directory
    405                     if (moveFilesStart)
    406                     {
    407                         tmpFileIds = getValidIntegerList(ItemIdField.VPARAM);
    408                         log.debug("tmpFileIds from ItemIdField.VPARAM = " + tmpFileIds);
    409                     }
    410                     else
    411                     {
    412                         tmpFileIds = getValidIntegerList(ViewActiveFile.VFILEID);
    413                         log.debug("tmpFileIds from ViewActiveFile.VFILEID = " + tmpFileIds);
    414                     }
    415                     log.debug("tmpFileIds = " + tmpFileIds);
    416                     // Add id values for selected files as parameters to action link
    417                     if (tmpFileIds != null && tmpFileIds.size() > 0)
    418                     {
    419                         // Set id values for source files
    420                         for (Integer fileId : tmpFileIds)
    421                         {
    422                             getFormFactory().addHiddenField(dirTable, ViewActiveFile.VFILEID, fileId);
    423                         }
    424                     }
    425                 }
    426392            }
    427393            title = new Title(formTitle);
     
    793759            clickAction.addParameter(NextButtonNameField.VPARAM,
    794760            nextButtonName);
    795             if (moveFilesMode)
    796             {
    797                 /*
    798                     * This action may be called several times when
    799                     * navigating from the source to the target directory.
    800                     * First time the id values for selected files are
    801                     * stored in the default valid parameter VInteger ItemIdField.VPARAM,
    802                     * otherwise they are stored in valid parameter VInteger ViewActiveFile.VFILEID.
    803                 */
    804                 List<Integer> tmpFileIds = null;
    805                 // Check if first time when navigating to target directory
    806                 if (moveFilesStart)
    807                 {
    808                     try
    809                     {
    810                         tmpFileIds = getValidIntegerList(ItemIdField.VPARAM);
    811                     }
    812                     catch (Exception e)
    813                     {
    814                         log.debug("Exception when trying to retrieve file id list from ItemIdField.VPARAM: " + e);
    815                     }
    816                     log.debug("tmpFileIds from ItemIdField.VPARAM = " + tmpFileIds);
    817                 }
    818                 else
    819                 {
    820                     try
    821                     {
    822                         tmpFileIds = getValidIntegerList(ViewActiveFile.VFILEID);
    823                     }
    824                     catch (Exception e)
    825                     {
    826                         log.debug("Exception when trying to retrieve file id list from ViewActiveFile.VFILEID: " + e);
    827                     }
    828                     log.debug("tmpFileIds from ViewActiveFile.VFILEID = " + tmpFileIds);
    829                 }
    830                 log.debug("tmpFileIds = " + tmpFileIds);
    831                 // Add id values for selected files as parameters to click action
    832                 if (tmpFileIds != null && tmpFileIds.size() > 0)
    833                 {
    834                     // Set id values for source files
    835                     for (Integer fileId : tmpFileIds)
    836                     {
    837                         clickAction.addParameter(ViewActiveFile.VFILEID, fileId);
    838                     }
    839                 }
    840             }
    841761        }
    842762        else
  • trunk/client/servlet/src/org/proteios/action/file/MoveFiles.java

    r2893 r3923  
    5959     * Verify parameters
    6060     */
    61     List<Integer> fileIds = getValidIntegerList(ViewActiveFile.VFILEID);
     61    //List<Integer> fileIds = getValidIntegerList(ViewActiveFile.VFILEID);
     62    List<Integer> fileIds = getSessionAttributeList(ViewActiveDirectory.VMOVEFILEIDLIST);
    6263    log.debug("fileIds = " + fileIds);
    6364    /*
     
    109110    setSessionAttribute(ViewActiveDirectory.VSELECTMOVEDIR, false);
    110111    setSessionAttribute(ViewActiveDirectory.VMOVEFILES, false);
     112    setSessionAttribute(ViewActiveDirectory.VMOVEFILEIDLIST, null);
    111113    String msg = new String(nFilesMoved + " file[s] moved.");
    112114    log.debug("msg = \"" + msg + "\"");
Note: See TracChangeset for help on using the changeset viewer.