Ignore:
Timestamp:
2006-09-01T11:38:53+12:00 (18 years ago)
Author:
mdewsnip
Message:

Changed all access to the static strings through CollectionConfiguration to directly use StaticStrings.

File:
1 edited

Legend:

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

    r12304 r12641  
    4343    implements Comparable, DOMProxyListEntry {
    4444    /** An values of items in the index level enumeration. */
    45     static protected final String LEVEL[] = {CollectionConfiguration.DOCUMENT_STR,  CollectionConfiguration.SECTION_STR, CollectionConfiguration.PARAGRAPH_STR};
     45    static protected final String LEVEL[] = {StaticStrings.DOCUMENT_STR,  StaticStrings.SECTION_STR, StaticStrings.PARAGRAPH_STR};
    4646
    4747    private ArrayList sources = null;
     
    6767    // Create a new element
    6868    Document document = CollectionDesignManager.collect_config.document;
    69     this.element = document.createElement(CollectionConfiguration.INDEX_ELEMENT);
     69    this.element = document.createElement(StaticStrings.INDEX_ELEMENT);
    7070    // For each source add a content element
    7171    int size = sources.size();
    7272    for(int i = 0; i < size; i++) {
    73         Element content_element = document.createElement(CollectionConfiguration.CONTENT_ELEMENT);
     73        Element content_element = document.createElement(StaticStrings.CONTENT_ELEMENT);
    7474        Object source_object = sources.get(i);
    7575        if (source_object instanceof MetadataElement) {
    7676        // System.err.println("Constructing new Index with MetadataElement source...");
    77         content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, ((MetadataElement) source_object).getFullName());
     77        content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, ((MetadataElement) source_object).getFullName());
    7878        }
    7979        else {
    8080        // System.err.println("Constructing new Index with String source...");
    81         content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, source_object.toString());
     81        content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, source_object.toString());
    8282        }
    8383        element.appendChild(content_element);
     
    9191    this(sources);
    9292    this.level = level;
    93     element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[level]);
     93    element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[level]);
    9494    }
    9595
     
    101101        }
    102102    }
    103     element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[this.level]);
     103    element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[this.level]);
    104104    }
    105105
     
    138138    public int getLevel() {
    139139    if(level == -1 && element != null) {
    140         String level_str = element.getAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE);
     140        String level_str = element.getAttribute(StaticStrings.LEVEL_ATTRIBUTE);
    141141        for(int i = 0; level == -1 && i < LEVEL.length; i++) {
    142142        if(level_str.equals(LEVEL[i])) {
     
    197197    if(sources == null) {
    198198        sources = new ArrayList();
    199         NodeList content_elements = element.getElementsByTagName(CollectionConfiguration.CONTENT_ELEMENT);
     199        NodeList content_elements = element.getElementsByTagName(StaticStrings.CONTENT_ELEMENT);
    200200        int content_elements_length = content_elements.getLength();
    201201        for(int i = 0; i < content_elements_length; i++) {
    202202        Element content_element = (Element) content_elements.item(i);
    203         String metadata_element_name_full = (String) content_element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     203        String metadata_element_name_full = (String) content_element.getAttribute(StaticStrings.NAME_ATTRIBUTE);
    204204        MetadataElement metadata_element = MetadataTools.getMetadataElementWithName(metadata_element_name_full);
    205205        if (metadata_element != null) {
     
    216216
    217217    public boolean isAssigned() {
    218     return (element != null && !element.getAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.FALSE_STR));
     218    return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR));
    219219    }
    220220
    221221    public void setAssigned(boolean assigned) {
    222222    if(element != null) {
    223         element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));
     223        element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR));
    224224    }
    225225    }
     
    237237    public void setLevel(int new_level) {
    238238    // System.err.println("SetLevel(" + new_level + ")");
    239     if(element != null && element.getNodeName().equals(CollectionConfiguration.INDEX_DEFAULT_ELEMENT)) {
     239    if(element != null && element.getNodeName().equals(StaticStrings.INDEX_DEFAULT_ELEMENT)) {
    240240        if (0 <= new_level && new_level < 3) {
    241         element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, LEVEL[new_level]);
     241        element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, LEVEL[new_level]);
    242242        } else {
    243         element.setAttribute(CollectionConfiguration.LEVEL_ATTRIBUTE, "");
     243        element.setAttribute(StaticStrings.LEVEL_ATTRIBUTE, "");
    244244        }
    245245        this.id = null; // Regenerate ID.
     
    255255     */
    256256    public void setSources(ArrayList sources) {
    257     if(element != null && element.getNodeName().equals(CollectionConfiguration.INDEX_DEFAULT_ELEMENT)) {
     257    if(element != null && element.getNodeName().equals(StaticStrings.INDEX_DEFAULT_ELEMENT)) {
    258258        // Erase old sources
    259259        XMLTools.clear(element);
     
    261261        int size = sources.size();
    262262        for(int i = 0; i < size; i++) {
    263         Element content_element = element.getOwnerDocument().createElement(CollectionConfiguration.CONTENT_ELEMENT);
     263        Element content_element = element.getOwnerDocument().createElement(StaticStrings.CONTENT_ELEMENT);
    264264        Object source_object = sources.get(i);
    265265        if (source_object instanceof MetadataElement) {
    266266            String name = ((MetadataElement) source_object).getFullName();
    267             content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, name);
     267            content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);
    268268            name = null;
    269269        }
    270270        else {
    271271            //DebugStream.println("Found String as source: " + source_object.toString());
    272             content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, source_object.toString());
     272            content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, source_object.toString());
    273273        }
    274274        source_object = null;
Note: See TracChangeset for help on using the changeset viewer.