metacat/src/edu/ucsb/nceas/metacat/dataone/SystemMetadataManager.java @ 5798
1 |
/**
|
---|---|
2 |
*
|
3 |
*/
|
4 |
package edu.ucsb.nceas.metacat.dataone; |
5 |
|
6 |
import java.util.*; |
7 |
import java.io.*; |
8 |
|
9 |
import edu.ucsb.nceas.metacat.*; |
10 |
|
11 |
/**
|
12 |
* @author berkley
|
13 |
*
|
14 |
* Class to handle SystemMetadata object in the metacat system
|
15 |
*/
|
16 |
public class SystemMetadataManager |
17 |
{
|
18 |
//singleton instance
|
19 |
private static SystemMetadataManager manager = null; |
20 |
private IdentifierManager idManager = null; |
21 |
|
22 |
/**
|
23 |
* private constructor. Use the singleton getInstance() method to use
|
24 |
* this class
|
25 |
*/
|
26 |
private SystemMetadataManager() |
27 |
{
|
28 |
idManager = IdentifierManager.getInstance(); |
29 |
}
|
30 |
|
31 |
/**
|
32 |
* get a singleton instance of this class
|
33 |
*/
|
34 |
public static SystemMetadataManager getInstance() |
35 |
{
|
36 |
if(manager == null) |
37 |
{
|
38 |
manager = new SystemMetadataManager(); |
39 |
}
|
40 |
return manager; |
41 |
}
|
42 |
|
43 |
/**
|
44 |
* return true if the document represented by guid has a system metadata
|
45 |
* document registered in the systemmetadata table
|
46 |
* @param guid
|
47 |
* @return
|
48 |
*/
|
49 |
public boolean documentHasSystemMetadata(String guid) |
50 |
{
|
51 |
boolean hassm = false; |
52 |
try
|
53 |
{
|
54 |
String smid = idManager.getSystemMetadataLocalId(guid); |
55 |
if(smid != null && !smid.trim().equals("")) |
56 |
{
|
57 |
hassm = true; |
58 |
}
|
59 |
}
|
60 |
catch(McdbDocNotFoundException me) |
61 |
{
|
62 |
//if this exception is thrown, the doc with guid does not have
|
63 |
//sys metadata
|
64 |
}
|
65 |
|
66 |
return hassm; |
67 |
}
|
68 |
}
|
- « Previous
- 1
- 2
- 3
- 4
- Next »