Changeset 29997

Show
Ignore:
Timestamp:
29.06.2015 14:01:07 (4 years ago)
Author:
kjdon
Message:

when getting extra metadata names, lets put them in a set and check it so we don't add the same ones to the list over and over again

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r29921 r29997  
    77import java.util.ArrayList; 
    88import java.util.HashMap; 
     9import java.util.HashSet; 
    910 
    1011import javax.xml.transform.Transformer; 
     
    383384        Document doc = XMLConverter.newDOM(); 
    384385        Element extraMetadataList = doc.createElement(GSXML.EXTRA_METADATA + GSXML.LIST_MODIFIER); 
     386        HashSet<String> name_set = new HashSet<String>(); 
    385387        for (File stylesheet : stylesheets) 
    386388        { 
     
    391393                for (String metadataString : requiredMetadata) 
    392394                { 
     395                  if (!name_set.contains(metadataString)) { 
     396                      name_set.add(metadataString); 
    393397                    Element metadataElem = doc.createElement(GSXML.EXTRA_METADATA); 
    394398                    metadataElem.setAttribute(GSXML.NAME_ATT, metadataString); 
    395399                    extraMetadataList.appendChild(metadataElem); 
     400                    } 
    396401                } 
    397402            }