01: package com.technoetic.xplanner.domain;
02:
03: import java.text.MessageFormat;
04:
05: public class StoryDisposition extends CharacterEnum {
06:
07: public static final String PLANNED_NAME = "planned";
08: public static final String CARRIED_OVER_NAME = "carriedOver";
09: public static final String DISCOVERED_NAME = "discovered";
10: public static final String ADDED_NAME = "added";
11: public static final String OVERHEAD_NAME = "overhead";
12:
13: private static final String NAME_KEY_TEMPLATE = "story.disposition.{0}.name";
14: private static final String ABBREVIATION_KEY_TEMPLATE = "story.disposition.{0}.abbreviation";
15:
16: public static final StoryDisposition PLANNED = new StoryDisposition(
17: 'p', PLANNED_NAME);
18: public static final StoryDisposition CARRIED_OVER = new StoryDisposition(
19: 'c', CARRIED_OVER_NAME);
20: public static final StoryDisposition ADDED = new StoryDisposition(
21: 'a', ADDED_NAME);
22:
23: public static final StoryDisposition[] enums = { PLANNED,
24: CARRIED_OVER, ADDED };
25:
26: public String getNameKey() {
27: return MessageFormat.format(NAME_KEY_TEMPLATE,
28: new String[] { name });
29: }
30:
31: public String getAbbreviationKey() {
32: return MessageFormat.format(ABBREVIATION_KEY_TEMPLATE,
33: new String[] { name });
34: }
35:
36: protected StoryDisposition(char code, String name) {
37: super (code, name);
38: }
39:
40: public CharacterEnum[] listEnums() {
41: return enums;
42: }
43:
44: public static StoryDisposition valueOf(String name) {
45: return (StoryDisposition) valueOf(name, enums);
46: }
47:
48: public static StoryDisposition fromCode(char code) {
49: return (StoryDisposition) fromCode(code, enums);
50: }
51:
52: public static StoryDisposition fromNameKey(String key) {
53: return (StoryDisposition) fromNameKey(key, enums);
54: }
55:
56: public static StoryDisposition fromName(String name) {
57: return (StoryDisposition) fromName(name, enums);
58: }
59: }
|