001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.api.action;
017
018import javax.xml.bind.annotation.XmlEnum;
019import javax.xml.bind.annotation.XmlEnumValue;
020import javax.xml.bind.annotation.XmlRootElement;
021import javax.xml.bind.annotation.XmlType;
022
023import org.kuali.rice.core.api.mo.common.Coded;
024
025@XmlRootElement(name = "actionRequestStatus")
026@XmlType(name = "ActionRequestStatusType")
027@XmlEnum
028public enum ActionRequestStatus implements Coded {
029
030        /**
031         * Code to indicate the request has been satisfied
032         */
033    @XmlEnumValue("D") DONE("D", "DONE"),
034    
035    /**
036     * Code to indicate the request is currently active
037     */
038    @XmlEnumValue("A") ACTIVATED("A", "ACTIVATED"),
039    
040    /**
041     * Code to indicate the request has not been activated
042     */
043    @XmlEnumValue("I") INITIALIZED("I", "INITIALIZED");
044        
045        private final String code;
046        private final String label;
047        
048        ActionRequestStatus(String code, String label) {
049                this.code = code;
050                this.label = label;
051        }
052        
053        @Override
054        public String getCode() {
055                return code;
056        }
057        
058        public String getLabel() {
059                return label;
060        }
061        
062        public static ActionRequestStatus fromCode(String code) {
063                if (code == null) {
064                        return null;
065                }
066                for (ActionRequestStatus request : values()) {
067                        if (request.code.equals(code)) {
068                                return request;
069                        }
070                }
071                throw new IllegalArgumentException("Failed to locate the ActionRequestStatus with the given code: " + code);
072        }
073        
074}