Changeset 1653


Ignore:
Timestamp:
02/28/08 16:17:19 (7 years ago)
Author:
th-schwarz
Message:

docu and cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/CommandHandler.java

    r1647 r1653  
    2525 
    2626/** 
    27  * Handler for the different resource getCommands. 
     27 * Handler for the get and post commands. 
    2828 *  
    2929 * @version $Id: ResourceTypeHandler.java 1606 2008-02-24 17:07:52Z th-schwarz $ 
     
    4343 
    4444        static { 
    45                 // initialize the getCommands 
     45                // initialize the get commands 
    4646                getCommands.put(GET_FOLDERS.getName(), GET_FOLDERS); 
    4747                getCommands.put(GET_FOLDERS_AND_FILES.getName(), GET_FOLDERS_AND_FILES); 
    4848                getCommands.put(CREATE_FOLDER.getName(), CREATE_FOLDER); 
     49                 
     50                // initialize the post commands 
    4951                postCommands.put(FILE_UPLOAD.getName(), FILE_UPLOAD); 
    5052                postCommands.put(QUICK_UPLOAD.getName(), QUICK_UPLOAD); 
     
    7173         *         argument. 
    7274         * @throws IllegalArgumentException 
    73          *             If 'name' is null can't be parsed. 
     75         *             If 'name' is null or can't be parsed. 
    7476         */ 
    7577        public static CommandHandler valueOf(final String name) throws IllegalArgumentException { 
     
    7779                        throw new IllegalArgumentException(); 
    7880 
    79                 // FIXME take commands from both maps! 
    80                 CommandHandler getRt = getCommands.get(name); 
    81                 CommandHandler postRt = postCommands.get(name); 
    82                 if (getRt == null && postRt == null) 
     81                if (!isValidForGet(name) && !isValidForPost(name)) 
    8382                        throw new IllegalArgumentException(); 
    84                 return getRt==null?postRt:getRt; 
     83                return (getCommands.get(name) != null) ? getCommands.get(name) : postCommands.get(name); 
    8584        } 
     85         
    8686 
    8787        /** 
    88          * Checks, if a specfied string is valid representation of a {@link CommandHandler}. 
     88         * Checks, if a specfied string is a valid representation of a get command. 
    8989         *  
    9090         * @param name 
    91          * @return True, if the string represrntation is valid, or false. 
     91         * @return True, if the string representation is valid, or false. 
    9292         */ 
    9393        public static boolean isValidForGet(final String name) { 
    9494                return getCommands.containsKey(name); 
    9595        } 
    96          
     96 
    9797        /** 
    98          * TODO document me! 
     98         * Checks, if a specfied string is a valid representation of a post command. 
     99         *  
     100         * @param name 
     101         * @return True, if the string representation is valid, or false. 
    99102         */ 
    100103        public static boolean isValidForPost(final String name) { 
Note: See TracChangeset for help on using the changeset viewer.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy