Changeset 12797


Ignore:
Timestamp:
2006-09-21T11:14:51+12:00 (18 years ago)
Author:
mdewsnip
Message:

Removed a lot of unused code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/download/Download.java

    r12641 r12797  
    8787     */
    8888    public DOMProxyListEntry create(Element element) {
    89 //  String download_name = element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
    90 //  // Determine the base classifier from the classifier name
    91 //  Classifier base_classifier = CollectionDesignManager.classifier_manager.getBaseClassifier(classifier_name);
    92 //  Classifier classifier = new Classifier(element, base_classifier);
    93 //  base_classifier = null;
    94 //  classifier_name = null;
    95 //  return classifier;
    9689    return null;
    9790    }
     
    157150    }
    158151
    159     /** Method to retrieve a download custom argument information. Custom arguments are defined to be those that have not got matching arguments in the base reference download from the library. Of course if there is no base download then all arguments are considered to be custom.
    160      * @return the custom arguments as a String
    161      */
    162     public String getCustom() {
    163     StringBuffer custom_text = new StringBuffer();
    164     // Retrieve all of the arguments, and append any that are custom into one long string
    165     ArrayList arguments = getArguments(false, true);
    166     int arguments_size = arguments.size();
    167     boolean first = true;
    168     for(int i = 0; i < arguments_size; i++) {
    169         Argument argument = (Argument) arguments.get(i);
    170         if(argument.isAssigned()) {
    171         if(!first) {
    172             custom_text.append(" ");
    173         }
    174         custom_text.append(argument.toString());
    175         first = false;
    176         }
    177     }
    178     return custom_text.toString();
    179     }
    180 
    181152    public String getDescription() {
    182153    return description;
     
    211182    }
    212183
    213     /** Set the custom arguments. This turns out to be quite tricky. We must parse in the string, searching for arguments (for that we use a handy method in CollectionConfiguration). Next, for each argument, we check if we already know about it. If so we update its value, otherwise we create a new argument and assign it (must assign!).
    214      * @param custom_str the custom arguments all splodged together in one String
    215      */
    216     public void setCustom(String custom_str) {
    217     HashMap raw_arguments = CollectionConfiguration.parseArguments(new CommandTokenizer(custom_str));
    218     ArrayList custom_arguments = getArguments(false, true);
    219     int size = custom_arguments.size();
    220     for(int i = 0; i < size; i++) {
    221         Argument argument = (Argument) custom_arguments.get(i);
    222         String original_argument_name = StaticStrings.MINUS_CHARACTER + argument.getName();
    223         if(raw_arguments.containsKey(original_argument_name)) {
    224         // Set as assigned
    225         argument.setAssigned(true);
    226         String argument_value = (String)raw_arguments.remove(original_argument_name);
    227         if(argument_value != null) {
    228             argument.setValue(argument_value);
    229             argument_value = null;
    230         }
    231         }
    232         // We've removed it from our custom statement, so unassign
    233         else {
    234         argument.setAssigned(false);
    235         }
    236         argument = null;
    237     }
    238     // Any left over, add to the download
    239     Iterator argument_names = raw_arguments.keySet().iterator();
    240     while(argument_names.hasNext()) {
    241         String argument_name = (String) argument_names.next();
    242         String argument_value = (String) raw_arguments.get(argument_name);
    243         // The tricky thing is that we have to create a new element in the DOM as well.
    244         Element argument_element = CollectionDesignManager.collect_config.document.createElement(StaticStrings.OPTION_ELEMENT);
    245         argument_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, argument_name.substring(1));
    246         argument_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR);
    247         argument_element.setAttribute(StaticStrings.CUSTOM_ATTRIBUTE, StaticStrings.TRUE_STR);
    248         Argument argument = new Argument(argument_element);
    249         argument_name = null;
    250         if(argument_value != null) {
    251         argument.setValue(argument_value);
    252         argument_value = null;
    253         }
    254         // All done. Add it.
    255         element.appendChild(argument_element);
    256         add(argument);
    257         argument_element = null;
    258     }
    259     raw_arguments = null;
    260     }
    261184
    262185    /** Method to set the value of desc.
Note: See TracChangeset for help on using the changeset viewer.