1 | package org.greenstone.gsdl3.gs3build.collection;
|
---|
2 |
|
---|
3 | import java.io.PrintWriter;
|
---|
4 |
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | import org.greenstone.gsdl3.gs3build.metadata.METSDescriptive;
|
---|
8 |
|
---|
9 | import org.greenstone.gsdl3.gs3build.doctypes.DocumentID;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * A class to consolidate the metadata assigned to the documents of a collection
|
---|
13 | * as per the extension to Greenstone 2 done by George Buchanan.
|
---|
14 | */
|
---|
15 |
|
---|
16 | public class CollectionMetadata
|
---|
17 | { METSDescriptive metadata;
|
---|
18 |
|
---|
19 | public CollectionMetadata()
|
---|
20 | { this.metadata = new METSDescriptive("CM0", "collection");
|
---|
21 | }
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Accrue the metadata assigned to a particular document
|
---|
25 | *
|
---|
26 | * @param <code>DocumentID</code> the document identifier
|
---|
27 | * @param <code>String</code> the namespace of the metadata
|
---|
28 | * @param <code>String</code> the field of metadata
|
---|
29 | * @param <code>String</code> the actual value assigned
|
---|
30 | */
|
---|
31 | public void addDocumentMetadata(DocumentID documentID, String namespace, String field, String value)
|
---|
32 | { // we don't presently use the document ID in this member function
|
---|
33 | this.metadata.addMetadata(namespace, field, value);
|
---|
34 | }
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Set the metadata stored on a given metadata item - any other values are
|
---|
38 | * destroyed.
|
---|
39 | *
|
---|
40 | * @param <code>String</code> the namespace
|
---|
41 | * @param <code>String</code> the label of the metadata
|
---|
42 | * @param <code>String</code> the actual value assigned
|
---|
43 | */
|
---|
44 | public void setCollectionMetadata(String namespace, String label, String value)
|
---|
45 | { this.metadata.setMetadata(namespace, label, value);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Get the metadata stored on a given metadata item
|
---|
50 | *
|
---|
51 | * @param <code>String</code> the namespace
|
---|
52 | * @param <code>String</code> the label of the metadata
|
---|
53 | */
|
---|
54 | public List getCollectionMetadata(String namespace, String label)
|
---|
55 | { return this.metadata.getMetadata(namespace, label);
|
---|
56 | }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Write the collection metadata
|
---|
60 | *
|
---|
61 | * TODO: dummy function - complete
|
---|
62 | */
|
---|
63 | public boolean write(PrintWriter writer)
|
---|
64 | { return false;
|
---|
65 | }
|
---|
66 | }
|
---|