01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.forms.event;
18:
19: import java.util.Iterator;
20: import java.util.List;
21: import java.util.Map;
22:
23: import org.apache.commons.lang.enums.ValuedEnum;
24:
25: /**
26: * Type-safe enumeration of the various form processing phases.
27: *
28: * @version $Id: ProcessingPhase.java 449149 2006-09-23 03:58:05Z crossley $
29: */
30: public class ProcessingPhase extends ValuedEnum {
31:
32: protected ProcessingPhase(String name, int value) {
33: super (name, value);
34: }
35:
36: public static final int PROCESSING_INITIALIZE_VALUE = 4;
37: public static final ProcessingPhase PROCESSING_INITIALIZE = new ProcessingPhase(
38: "Processing initialize", PROCESSING_INITIALIZE_VALUE);
39:
40: public static final int LOAD_MODEL_VALUE = 0;
41: public static final ProcessingPhase LOAD_MODEL = new ProcessingPhase(
42: "Load model", LOAD_MODEL_VALUE);
43:
44: public static final int READ_FROM_REQUEST_VALUE = 1;
45: public static final ProcessingPhase READ_FROM_REQUEST = new ProcessingPhase(
46: "Read from request", READ_FROM_REQUEST_VALUE);
47:
48: public static final int VALIDATE_VALUE = 2;
49: public static final ProcessingPhase VALIDATE = new ProcessingPhase(
50: "Validate", VALIDATE_VALUE);
51:
52: public static final int SAVE_MODEL_VALUE = 3;
53: public static final ProcessingPhase SAVE_MODEL = new ProcessingPhase(
54: "Save model", SAVE_MODEL_VALUE);
55:
56: public static ProcessingPhase getEnum(String name) {
57: return (ProcessingPhase) getEnum(ProcessingPhase.class, name);
58: }
59:
60: public static ProcessingPhase getEnum(int value) {
61: return (ProcessingPhase) getEnum(ProcessingPhase.class, value);
62: }
63:
64: public static Map getEnumMap() {
65: return getEnumMap(ProcessingPhase.class);
66: }
67:
68: public static List getEnumList() {
69: return getEnumList(ProcessingPhase.class);
70: }
71:
72: public static Iterator iterator() {
73: return iterator(ProcessingPhase.class);
74: }
75: }
|