aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/common/show/item/ShowItem.java
blob: d1d1be1002e9d65cc8116e563d9d4bcb3c0051e7 (plain)
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
/**
 * 
 */
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;
  }
}