aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/common/show/item
diff options
context:
space:
mode:
authorMatt Windsor <mattwindsor@btinternet.com>2011-03-21 21:54:31 +0000
committerMatt Windsor <mattwindsor@btinternet.com>2011-03-21 21:54:31 +0000
commitdf7d7981b56a4560c95ea7e9b194080e93398ecf (patch)
treeb3ae4f02d23ae1f7f4951c776ee8d91b0047dd6f /src/uk/org/ury/common/show/item
parent2d073129857a42ab4195cd433c8be152e357033f (diff)
GREAT PACKAGE RESHUFFLE: Everything is now organised into frontend, backend and common (to frontend and backend) packages. Things may have been broken. Doc refresh.
Diffstat (limited to 'src/uk/org/ury/common/show/item')
-rw-r--r--src/uk/org/ury/common/show/item/ShowItem.java68
-rw-r--r--src/uk/org/ury/common/show/item/ShowItemProperty.java26
-rw-r--r--src/uk/org/ury/common/show/item/package.html14
3 files changed, 108 insertions, 0 deletions
diff --git a/src/uk/org/ury/common/show/item/ShowItem.java b/src/uk/org/ury/common/show/item/ShowItem.java
new file mode 100644
index 0000000..d1d1be1
--- /dev/null
+++ b/src/uk/org/ury/common/show/item/ShowItem.java
@@ -0,0 +1,68 @@
+/**
+ *
+ */
+package uk.org.ury.common.show.item;
+
+
+import java.util.Map;
+
+import uk.org.ury.backend.database.DatabaseItem;
+import uk.org.ury.backend.database.exceptions.MissingPropertyException;
+
+
+/**
+ * An item in the show database.
+ *
+ * @author Matt Windsor
+ */
+
+public class ShowItem extends DatabaseItem<ShowItemProperty, String>
+{
+ /**
+ * Construct a new ShowItem.
+ *
+ * @param properties The map of properties to store in the show item.
+ */
+
+ public
+ ShowItem (Map<ShowItemProperty, String> properties)
+ {
+ super (properties);
+ }
+
+
+ /**
+ * @return a string representation of the ShowItem.
+ */
+
+ @Override
+ public String
+ toString ()
+ {
+ String name1;
+ String name2;
+
+ try
+ {
+ name1 = get (ShowItemProperty.NAME1);
+ }
+ catch (MissingPropertyException e1)
+ {
+ name1 = "Unknown";
+ }
+
+ try
+ {
+ name2 = get (ShowItemProperty.NAME2);
+ }
+ catch (MissingPropertyException e2)
+ {
+ name2 = null;
+ }
+
+ if (name2 != null)
+ return name1 + " - " + name2;
+ else
+ return name1;
+ }
+}
diff --git a/src/uk/org/ury/common/show/item/ShowItemProperty.java b/src/uk/org/ury/common/show/item/ShowItemProperty.java
new file mode 100644
index 0000000..43d4e99
--- /dev/null
+++ b/src/uk/org/ury/common/show/item/ShowItemProperty.java
@@ -0,0 +1,26 @@
+package uk.org.ury.common.show.item;
+
+
+/**
+ * Enumeration of the parameters that are stored in a ShowItem.
+ *
+ * @author Matt Windsor
+ */
+
+public enum ShowItemProperty
+ {
+ // Constant SQL identifier
+ NAME1 ("name1"),
+ NAME2 ("name2"),
+ POSITION ("positionid");
+
+
+ public final String sql;
+
+
+ private
+ ShowItemProperty (String sql)
+ {
+ this.sql = sql;
+ }
+ }; \ No newline at end of file
diff --git a/src/uk/org/ury/common/show/item/package.html b/src/uk/org/ury/common/show/item/package.html
new file mode 100644
index 0000000..0b2af5a
--- /dev/null
+++ b/src/uk/org/ury/common/show/item/package.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+
+<HTML>
+ <HEAD>
+ <TITLE>uk.org.ury.show.item</TITLE>
+ </HEAD>
+ <BODY>
+ <P>The show item class and related properties.</P>
+ <P>The two contained classes, ShowItem and ShowItemProperty,
+ implement the storage of items (songs, audio tracks, etc) that
+ can be placed in show channels.</P>
+ </BODY>
+</HTML> \ No newline at end of file