1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/**
*
*/
package uk.org.ury.library;
import java.util.Map;
/**
* An item in the URY library.
*
* @author Matt Windsor
*/
public class LibraryItem
{
/**
* The parameters that are stored in the LibraryItem.
*
* @author Matt Windsor
*/
public enum LibraryProperty
{
// Constant SQL identifier
TITLE ("title"),
ALBUM ("album"),
ARTIST ("artist"),
LABEL ("label"),
STATUS ("status"),
MEDIUM ("medium"),
FORMAT ("format"),
DATE_RELEASED ("datereleased"),
DATE_ADDED ("dateadded"),
DATE_EDITED ("dateedited"),
SHELF_LETTER ("shelfletter"),
SHELF_NUMBER ("shelfnumber"),
CD_ID ("cdid"),
ADD_MEMBER_ID ("memberid_add"),
EDIT_MEMBER_ID ("memberid_lastedit"),
ADD_FORENAME ("fnameadd"),
ADD_SURNAME ("snameadd"),
EDIT_FORENAME ("fnameedit"),
EDIT_SURNAME ("snameedit"),
IS_DIGITISED ("digitised"),
IS_CLEAN ("clean");
public final String sql;
private
LibraryProperty (String sql)
{
this.sql = sql;
}
};
private Map<LibraryProperty, String> properties;
/**
* Construct a new library item from an existing list of
* properties.
*
* @param properties The map of properties that the new item will
* inherit.
*/
public
LibraryItem (Map<LibraryProperty, String> properties)
{
this.properties = properties;
}
/**
* Query this item for a property.
*
* @param property The property to query.
* @return The property, if it exists, or "Unknown" otherwise.
*/
public String
get (LibraryProperty property)
{
if (properties.containsKey (property))
return properties.get (property);
else
return "Unknown";
}
}
|