Ignore:
Timestamp:
2003-12-17T13:14:49+13:00 (20 years ago)
Author:
cs025
Message:

Various changes to the METS structures and identifier factories to
move towards updateable structures and to add section support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSDescriptive.java

    r5945 r6287  
    123123  }
    124124
    125     /**
    126     *  Fetch a <code>List</code> of the values matching the given label in
    127     *  the requisite namespace.
    128     *
    129     *  @param <code>String</code> namespace
    130     *  @param <code>String</code> label of metadata to match
    131     *
    132     *  @return <code>List</code> the corresponding values found.
    133     */
    134     public List getMetadata(String namespace, String label)
    135     {
    136         // Simple case - no metadata
    137         if (!this.map.containsKey(namespace))
    138         { return null;
    139         }
    140 
    141         // if there's just one instance of the requisite namespace,
    142         // then again it is a simple case
    143         if (this.map.getAll(namespace).size() == 1)
    144         {   return this.getNamespace(namespace).getMetadata(label);
    145         }
    146 
    147         // otherwise, step through and accumulate
    148         List accumulatedValues = new ArrayList();
    149         Iterator namespaceIterator = this.map.getAll(namespace).iterator();
    150         while (namespaceIterator.hasNext())
    151         {   METSNamespace localNamespace = (METSNamespace) namespaceIterator.next();
    152 
    153             List localList = localNamespace.getMetadata(label);
    154             if (localList != null && localList.size() > 0)
    155             {   accumulatedValues.addAll(localList);
    156             }
    157         }
    158 
    159         // if the result of the accumulation is empty, return a null item
    160         if (accumulatedValues.size() == 0)
    161         { return null;
    162         }
    163 
    164         return accumulatedValues;
    165     }
     125  /**
     126  *  Fetch a <code>List</code> of the values matching the given label in
     127  *  the requisite namespace.
     128  *
     129  *  @param <code>String</code> namespace
     130  *  @param <code>String</code> label of metadata to match
     131  *
     132  *  @return <code>List</code> the corresponding values found.
     133  */
     134  public List getMetadata(String namespace, String label)
     135  {
     136    // Simple case - no metadata
     137    if (!this.map.containsKey(namespace))
     138    { return null;
     139    }
     140
     141    // if there's just one instance of the requisite namespace,
     142    // then again it is a simple case
     143    if (this.map.getAll(namespace).size() == 1)
     144    {   return this.getNamespace(namespace).getMetadata(label);
     145    }
     146
     147    // otherwise, step through and accumulate
     148    List accumulatedValues = new ArrayList();
     149    Iterator namespaceIterator = this.map.getAll(namespace).iterator();
     150    while (namespaceIterator.hasNext())
     151    { METSNamespace localNamespace = (METSNamespace) namespaceIterator.next();
     152
     153      List localList = localNamespace.getMetadata(label);
     154      if (localList != null && localList.size() > 0)
     155      { accumulatedValues.addAll(localList);
     156      }
     157    }
     158
     159    // if the result of the accumulation is empty, return a null item
     160    if (accumulatedValues.size() == 0)
     161    { return null;
     162    }
     163
     164    return accumulatedValues;
     165  }
    166166
    167167    /**
Note: See TracChangeset for help on using the changeset viewer.