Ignore:
Timestamp:
2004-10-13T14:48:20+13:00 (20 years ago)
Author:
mdewsnip
Message:

Finally committing the (many) changes to the GLI to use the new metadata code... I hope this doesn't have too many bugs in it and committing it now doesn't stuff anyone up! (Katherine said I could commit it, so blame her if anything goes wrong).

File:
1 edited

Legend:

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

    r8243 r8313  
    3030import org.greenstone.gatherer.DebugStream;
    3131import org.greenstone.gatherer.Gatherer;
    32 import org.greenstone.gatherer.msm.ElementWrapper;
     32import org.greenstone.gatherer.metadata.MetadataElement;
     33import org.greenstone.gatherer.metadata.MetadataSet;
     34import org.greenstone.gatherer.metadata.MetadataSetManager;
     35import org.greenstone.gatherer.metadata.MetadataTools;
    3336import org.greenstone.gatherer.util.StaticStrings;
    3437import org.greenstone.gatherer.util.Utility;
     
    7376        Element content_element = document.createElement(CollectionConfiguration.CONTENT_ELEMENT);
    7477        Object source_object = sources.get(i);
    75         if(source_object instanceof ElementWrapper) {
    76         ///DebugStream.println("Found ElementWrapper as source: " + ((ElementWrapper)source_object).getName());
    77         content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, ((ElementWrapper)source_object).getName());
     78        if (source_object instanceof MetadataElement) {
     79        // System.err.println("Constructing new Index with MetadataElement source...");
     80        content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, ((MetadataElement) source_object).getFullName());
    7881        }
    7982        else {
    80         ///DebugStream.println("Found String as source: " + source_object.toString());
     83        // System.err.println("Constructing new Index with String source...");
    8184        content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, source_object.toString());
    8285        }
     
    166169        for(int i = 0; i < sources_size; i++) {
    167170        Object source_object = sources.get(i);
    168         // If its an element wrapper use the unique name rather than the
    169         if(source_object instanceof ElementWrapper) {
    170             String full_element_name = ((ElementWrapper)source_object).getName();
     171        if (source_object instanceof MetadataElement) {
     172            String full_element_name = ((MetadataElement)source_object).getFullName();
    171173            if(full_element_name.startsWith(StaticStrings.EXTRACTED_NAMESPACE)) {
    172174               id_buffer.append(full_element_name.substring(StaticStrings.EXTRACTED_NAMESPACE.length()));
     
    206208        for(int i = 0; i < content_elements_length; i++) {
    207209        Element content_element = (Element) content_elements.item(i);
    208         String source_str = (String) content_element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
    209         ElementWrapper element_wrapper = Gatherer.c_man.getCollection().msm.getElement(source_str);
    210         if(element_wrapper != null) {
    211             sources.add(element_wrapper);
     210        String metadata_element_name_full = (String) content_element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
     211        MetadataElement metadata_element = MetadataTools.getMetadataElementWithDisplayName(metadata_element_name_full);
     212        if (metadata_element != null) {
     213            sources.add(metadata_element);
    212214        }
    213215        else {
    214             sources.add(source_str);
     216            sources.add(metadata_element_name_full);
    215217        }
    216218        }
     
    267269        Element content_element = element.getOwnerDocument().createElement(CollectionConfiguration.CONTENT_ELEMENT);
    268270        Object source_object = sources.get(i);
    269         if(source_object instanceof ElementWrapper) {
    270             //DebugStream.println("Found ElementWrapper as source: " + ((ElementWrapper)source_object).getName());
    271             String name = ((ElementWrapper)source_object).getName();
     271        if (source_object instanceof MetadataElement) {
     272            String name = ((MetadataElement) source_object).getFullName();
    272273            content_element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, name);
    273274            name = null;
Note: See TracChangeset for help on using the changeset viewer.