View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.kuali.rice.kew.api.action;
17  
18  import javax.xml.bind.annotation.XmlEnum;
19  import javax.xml.bind.annotation.XmlEnumValue;
20  import javax.xml.bind.annotation.XmlRootElement;
21  import javax.xml.bind.annotation.XmlType;
22  
23  import org.kuali.rice.core.api.mo.common.Coded;
24  import org.kuali.rice.kew.api.KewApiConstants;
25  
26  @XmlRootElement(name = "actionRequestStatus")
27  @XmlType(name = "ActionRequestStatusType")
28  @XmlEnum
29  public enum ActionRequestStatus implements Coded {
30  
31  	/**
32  	 * Code to indicate the request has been satisfied
33  	 */
34      @XmlEnumValue(KewApiConstants.ActionRequestStatusVals.DONE)
35          DONE(KewApiConstants.ActionRequestStatusVals.DONE, "DONE"),
36      
37      /**
38       * Code to indicate the request is currently active
39       */
40      @XmlEnumValue(KewApiConstants.ActionRequestStatusVals.ACTIVATED)
41              ACTIVATED(KewApiConstants.ActionRequestStatusVals.ACTIVATED, "ACTIVATED"),
42      
43      /**
44       * Code to indicate the request has not been activated
45       */
46      @XmlEnumValue(KewApiConstants.ActionRequestStatusVals.INITIALIZED)
47              INITIALIZED(KewApiConstants.ActionRequestStatusVals.INITIALIZED, "INITIALIZED");
48  	
49  	private final String code;
50  	private final String label;
51  	
52  	ActionRequestStatus(String code, String label) {
53  		this.code = code;
54  		this.label = label;
55  	}
56  	
57  	@Override
58  	public String getCode() {
59  		return code;
60  	}
61  	
62  	public String getLabel() {
63  		return label;
64  	}
65  	
66  	public static ActionRequestStatus fromCode(String code) {
67  		if (code == null) {
68  			return null;
69  		}
70  		for (ActionRequestStatus request : values()) {
71  			if (request.code.equals(code)) {
72  				return request;
73  			}
74  		}
75  		throw new IllegalArgumentException("Failed to locate the ActionRequestStatus with the given code: " + code);
76  	}
77  	
78  }