01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.frontend;
17:
18: import org.outerj.daisy.navigation.NavigationVersionMode;
19:
20: public class WikiVersionMode {
21: private final String name;
22: private final NavigationVersionMode navigationVersionMode;
23:
24: private WikiVersionMode(String name,
25: NavigationVersionMode navigationVersionMode) {
26: this .name = name;
27: this .navigationVersionMode = navigationVersionMode;
28: }
29:
30: public String toString() {
31: return name;
32: }
33:
34: public static WikiVersionMode fromString(String mode) {
35: if (LIVE.name.equalsIgnoreCase(mode)) {
36: return LIVE;
37: } else if (LAST.name.equalsIgnoreCase(mode)) {
38: return LAST;
39: } else {
40: throw new RuntimeException("Invalid version mode: \""
41: + mode + "\".");
42: }
43: }
44:
45: public NavigationVersionMode getNavigationVersionMode() {
46: return navigationVersionMode;
47: }
48:
49: public static WikiVersionMode LIVE = new WikiVersionMode("live",
50: NavigationVersionMode.LIVE);
51: public static WikiVersionMode LAST = new WikiVersionMode("last",
52: NavigationVersionMode.LAST);
53: }
|