Changeset 20439 for gli

Show
Ignore:
Timestamp:
30.08.2009 18:41:00 (10 years ago)
Author:
kjdon
Message:

Argument now controls the conversion between metadata display name and proper name for arguments. The underlying XML holds the proper name eg dc.Subject, while the toString and getValue methods show the display name eg dc.Subject and Keywords

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/cdm/Argument.java

    r18912 r20439  
    103103  /** The argument flag as it appears in the command. Also used as the unique identifier of an argument. */ 
    104104  private String name = null; 
     105    /** The value of the arg, stored for metadata type options */ 
     106    private String stored_value = null; 
    105107  /** The plugin that owns this argument, for the purposes of visualising inheritance. */ 
    106108  private String owner = null; 
     
    264266      return null; 
    265267    } 
    266  
    267     return XMLTools.getValue(element); 
     268    if (stored_value != null) { 
     269    return stored_value; 
     270    } 
     271    String value = XMLTools.getValue(element); 
     272    if (type == METADATA) { 
     273    // We display using metadata display name, but store in the XML using 
     274    // full name (canonical name) 
     275    stored_value = MetadataTools.convertMetadataElementListNames(value, MetadataTools.TO_DISPLAY_NAMES); 
     276    return stored_value; 
     277    } 
     278    return value;  
    268279  } 
    269280 
     
    451462  public void setValue(String value) { 
    452463    if(element != null) { 
    453       XMLTools.setValue(element, value); 
     464    if (type == METADATA) { 
     465        value = MetadataTools.convertMetadataElementListNames(value, MetadataTools.FROM_DISPLAY_NAMES); 
     466        stored_value = value; 
     467    } 
     468    XMLTools.setValue(element, value); 
    454469    } 
    455470    else { 
     
    500515    text.append(name); 
    501516 
    502     String value = XMLTools.getValue(element); 
     517    String value = getValue(); //XMLTools.getValue(element); 
    503518    if (value.length() == 0) { 
    504519      return text.toString();