Changeset 36241 for main/trunk


Ignore:
Timestamp:
2022-06-07T10:05:30+12:00 (23 months ago)
Author:
kjdon
Message:

removed commented out code. for gs2, the collect.cfg has no way to differentiate between a text string for eg Date index and Date sortfield. (all are collectionmeta .Title titles) So. give them all the same type (search) and the existing code will handle not having duplicates - don't want the user to add a string for index:title and for sort:title. so now just has one opportunity, in search:title

File:
1 edited

Legend:

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

    r36185 r36241  
    4444  public static final String TYPE_SORT = "sort";
    4545  public static final String TYPE_FACET = "facet";
     46
     47    // gs2 all meta have the same type, as there is currently no distinction in
     48    // config file
     49    public static final String TYPE_SEARCH = "search";
    4650 
    4751    //    public SearchMeta() {
     
    5155     */
    5256    public SearchMeta(Element element) {
    53     System.err.println("new search meta, elem = ");
    54     System.err.println(XMLTools.xmlNodeToString(element));
    5557    this.element = element;
    5658    }
     
    6264    public SearchMeta(String name, String type) {
    6365    this(name, type, Configuration.getLanguage());
    64     // element = CollectionConfiguration.createElement(StaticStrings.SEARCHMETADATA_ELEMENT);
    65     // element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
    66     // element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, Configuration.getLanguage());
    67     // element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
    68     // element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);
    6966    }
    7067
     
    7572    element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, language);
    7673    element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);
    77     element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);
     74    if (Gatherer.GS3) {
     75        element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);
     76    } else {
     77        element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, TYPE_SEARCH);
     78    }
    7879    }
    7980
     
    104105     */
    105106    public boolean equals(Object object) {
    106       // System.err.println("running search meta equals");
    107       //   if (object instanceof SearchMeta) {
    108       //       if (compareTo(object) == 0 && getType().equals(((SearchMeta)object).getType())) {
    109       //    return true;
    110       //       }
    111       //   }
    112       //   return false;
    113107    return (compareTo(object) == 0);
    114108     }
    115109
    116     // public Element getElement() {
    117     //  return element;
    118     // }
    119 
    120     // /** Method to retrieve the value of language.
    121     //  * @return the value of language as a <strong>String</strong>.
    122     //  */
    123     // public String getLanguage() {
    124     //  // Retrieve the language string
    125     //  return element.getAttribute(StaticStrings.LANGUAGE_ATTRIBUTE);
    126     // }
    127 
    128     // /** Method to retrieve the value of name.
    129     //  * @return the name attribute of the collection meta as a String
    130     //  */
    131     // public String getName() {
    132     //  return element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    133     // }
    134     // /** Method to retrieve the value of value (well great choice of name there).
    135     //  * @return The value of value as a <strong>String</strong>.
    136     //  */
    137     // public String getValue(boolean text_value) {
    138     //  String raw_value = XMLTools.getValue(element);
    139     //  // Decode the raw value depending on whether the user asked for the TEXT or GREENSTONE version
    140     //  if(text_value == TEXT) {
    141     //      return Codec.transform(raw_value, Codec.DOM_TO_TEXT);
    142     //  }
    143     //  else {
    144     //      return Codec.transform(raw_value, Codec.DOM_TO_GREENSTONE);
    145     //  }
    146     // }
    147 
    148     // public boolean isAssigned() {
    149     //  return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR));
    150     // }
    151 
    152     // public boolean isDummy() {
    153     //  return dummy;
    154     // }
    155 
    156     // /** Determine if this metadata is one of the four special pieces of metadata.
    157     //  * @return true if this metadata is special, false otherwise.
    158     //  */
    159     // public boolean isSpecial() {
    160     //  return (element != null && element.getAttribute(StaticStrings.SPECIAL_ATTRIBUTE).equals(StaticStrings.TRUE_STR));
    161     // }
    162 
    163     // public void setAssigned(boolean assigned) {
    164     //  if(element != null) {
    165     //      element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR));
    166     //  }
    167     // }
    168 
    169     // public void setElement(Element element) {
    170     //  this.element = element;
    171     //  text = null;
    172     // }
    173 
    174     // /** Change the value of value.
    175     //  * @param raw_value the new value as a String.
    176     //  */
    177     // public void setValue(String raw_value) {
    178     //  setValue(raw_value, false);
    179     // }
    180 
    181     // public void setValue(String raw_value, boolean preserveTags) {
    182     //  // we need to check if the value has changed
    183     //  String current_value = XMLTools.getValue(element);
    184    
    185     //  String new_value = preserveTags ?
    186     //      Codec.transform(raw_value, Codec.TEXT_TO_DOM_PRESERVE_TAGS)
    187     //      : Codec.transform(raw_value, Codec.TEXT_TO_DOM);
    188     //  if (!current_value.equals(new_value)) {
    189     //      // Only raw html text can be given to setValue so we need to encode it
    190     //      XMLTools.setValue(element, new_value);
    191     //      text = null; // Reset text
    192     //      // And determine if this makes the metadata assigned
    193     //      setAssigned(raw_value != null && raw_value.length() > 0);
    194     //  }
    195     // }
    196110
    197111  public void setType(String type) {
    198112    if(element != null) {
    199       element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);
     113    if (Gatherer.GS3) {
     114        element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);
     115    } else {
     116        element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, TYPE_SEARCH);
     117    }
    200118    }
    201119  }
    202120    public String getType() {
    203121    if (element != null) {
     122
    204123        return element.getAttribute(StaticStrings.TYPE_ATTRIBUTE);
    205124    }
Note: See TracChangeset for help on using the changeset viewer.