diff options
author | Matt Windsor <matt@deling.(none)> | 2011-03-18 08:28:09 +0000 |
---|---|---|
committer | Matt Windsor <matt@deling.(none)> | 2011-03-18 08:28:09 +0000 |
commit | d547f87da5f68c12dede7c9d45618cae11ff5699 (patch) | |
tree | 613aa95d94b363c72ba9a7be639c74f76edf81f8 /src/uk/org/ury/library/item | |
parent | c8bb324e757587e742df0824304144e1eb881cee (diff) |
Mega-commit to the rescue! Added Javadoc snapshot (admittedly old); show UI now fixed-layout; UI uses system selection colours for accents; now uses bapsserver password and can thus talk to show database relations; removed member relation dependencies until further notice; attempted to get application and applet launchers working but having issues with the latter; started working on a server communicating via a minimal implementation of HTTP 1.1 (standardisation required eventually).
Diffstat (limited to 'src/uk/org/ury/library/item')
-rw-r--r-- | src/uk/org/ury/library/item/LibraryItem.java | 26 | ||||
-rw-r--r-- | src/uk/org/ury/library/item/LibraryItemProperty.java | 62 |
2 files changed, 88 insertions, 0 deletions
diff --git a/src/uk/org/ury/library/item/LibraryItem.java b/src/uk/org/ury/library/item/LibraryItem.java new file mode 100644 index 0000000..d2a790b --- /dev/null +++ b/src/uk/org/ury/library/item/LibraryItem.java @@ -0,0 +1,26 @@ +/** + * + */ +package uk.org.ury.library.item; + + +import java.util.Map; + +import uk.org.ury.database.DatabaseItem; + + +/** + * An item in the URY library. + * + * @author Matt Windsor + */ + +public class LibraryItem extends DatabaseItem<LibraryItemProperty, + String> +{ + public + LibraryItem (Map<LibraryItemProperty, String> properties) + { + super (properties); + } +}
\ No newline at end of file diff --git a/src/uk/org/ury/library/item/LibraryItemProperty.java b/src/uk/org/ury/library/item/LibraryItemProperty.java new file mode 100644 index 0000000..44f5f22 --- /dev/null +++ b/src/uk/org/ury/library/item/LibraryItemProperty.java @@ -0,0 +1,62 @@ +package uk.org.ury.library.item; + +/** + * The parameters that are stored in the LibraryItem. + * + * @author Matt Windsor + */ + +public enum LibraryItemProperty + { + // 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"), + IS_DIGITISED ("digitised"), + IS_CLEAN ("clean"); + + + public final String sql; + + + private + LibraryItemProperty (String sql) + { + this.sql = sql; + } + + + /** + * Retrieve a LibraryItemProperty given its SQL identifier. + * + * @param string The SQL identifier. + * @return The first property to match. + * + * @throws IllegalArgumentException if no matches were + * found. + */ + + public static LibraryItemProperty + getFromSQL (String string) + { + // TODO: Better exception? + + for (LibraryItemProperty prop : values ()) + { + if (prop.sql.equals (string)) + return prop; + } + + throw new IllegalArgumentException ("Nonexistent property SQL."); + } + };
\ No newline at end of file |