1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2008 Regents of the University of California and the
|
4
|
* National Center for Ecological Analysis and Synthesis
|
5
|
*
|
6
|
* Author: Benjamin Leinfelder
|
7
|
* '$Date: $'
|
8
|
* '$Revision: $'
|
9
|
*
|
10
|
* This program is free software; you can redistribute it and/or modify
|
11
|
* it under the terms of the GNU General Public License as published by
|
12
|
* the Free Software Foundation; either version 2 of the License, or
|
13
|
* (at your option) any later version.
|
14
|
*
|
15
|
* This program is distributed in the hope that it will be useful,
|
16
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
* GNU General Public License for more details.
|
19
|
*
|
20
|
* You should have received a copy of the GNU General Public License
|
21
|
* along with this program; if not, write to the Free Software
|
22
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
*/
|
24
|
package edu.ucsb.nceas.metacat.cart;
|
25
|
|
26
|
import java.util.HashMap;
|
27
|
import java.util.Map;
|
28
|
|
29
|
public class DocumentCart {
|
30
|
|
31
|
|
32
|
private Map docids = new HashMap();
|
33
|
|
34
|
private Map fields = new HashMap();
|
35
|
|
36
|
public void addDocument(String docid, Map fields) {
|
37
|
docids.put(docid, fields);
|
38
|
}
|
39
|
|
40
|
public void removeDocument(String docid) {
|
41
|
docids.remove(docid);
|
42
|
}
|
43
|
|
44
|
public Map getFields(String docid) {
|
45
|
return (Map) docids.get(docid);
|
46
|
}
|
47
|
|
48
|
public String[] getDocids() {
|
49
|
return (String[]) docids.keySet().toArray(new String[0]);
|
50
|
}
|
51
|
|
52
|
public void clear() {
|
53
|
docids.clear();
|
54
|
}
|
55
|
|
56
|
//for accessing the metadata attribute field mappings
|
57
|
public void addField(String label, String path) {
|
58
|
fields.put(label, path);
|
59
|
}
|
60
|
|
61
|
public void removeField(String label) {
|
62
|
fields.remove(label);
|
63
|
}
|
64
|
|
65
|
public void clearFields() {
|
66
|
fields.clear();
|
67
|
}
|
68
|
|
69
|
public Map getFields() {
|
70
|
return fields;
|
71
|
}
|
72
|
|
73
|
public void addFields(Map f) {
|
74
|
fields.putAll(f);
|
75
|
}
|
76
|
|
77
|
public String[] getLabels() {
|
78
|
return (String[]) fields.keySet().toArray(new String[0]);
|
79
|
}
|
80
|
|
81
|
public String[] getPaths() {
|
82
|
return (String[]) fields.values().toArray(new String[0]);
|
83
|
}
|
84
|
}
|