Changeset 36151


Ignore:
Timestamp:
2022-05-09T09:48:37+12:00 (5 months ago)
Author:
kjdon
Message:

Facet and SortField inherit from Index, as basically the same code but diff element names. added getElementName() and getDefaultElementName() so that the subclasses can use their own element names

Location:
main/trunk/gli/src/org/greenstone/gatherer/cdm
Files:
2 added
1 edited

Legend:

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

    r36138 r36151  
    4949    protected Element element = null;
    5050    /** The name for our elements */
    51     protected String element_name = StaticStrings.INDEX_ELEMENT;
     51    static final String index_element = StaticStrings.INDEX_ELEMENT;
    5252    /** The name for the default element */
    53     protected String default_element_name = StaticStrings.INDEX_DEFAULT_ELEMENT;
     53    static final String default_index_element = StaticStrings.INDEX_DEFAULT_ELEMENT;
    5454    /** The unique, if cryptic, identifier of an index. */
    5555    protected String id = null;
     
    6868    this.sources = sources;
    6969    // Create a new element
    70     this.element = CollectionConfiguration.createElement(this.element_name);
     70    this.element = CollectionConfiguration.createElement(getElementName());
    7171    // For each source add a content element
    7272    int size = sources.size();
     
    8787    }
    8888
     89    protected String getElementName() {
     90    return index_element;
     91    }
     92
     93    protected String getDefaultElementName() {
     94    return default_index_element;
     95    }
     96
    8997    /** Method to compare two indexes.
    9098     * @param object The other index as an <strong>Object</strong>.
     
    102110    public DOMProxyListEntry create(Element element) {
    103111    return new Index(element);
     112    }
     113    public DOMProxyListEntry create(ArrayList sources) {
     114    return new Index(sources);
    104115    }
    105116
     
    196207     */
    197208    public void setSources(ArrayList sources) {
    198     if(element != null && element.getNodeName().equals(this.default_element_name)) {
     209    if(element != null && element.getNodeName().equals(getDefaultElementName())) {
    199210        // Erase old sources
    200211        XMLTools.clear(element);
Note: See TracChangeset for help on using the changeset viewer.