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 = "actionRequestType") 026@XmlType(name = "ActionRequestTypeType") 027@XmlEnum 028public enum ActionRequestType implements Coded { 029 030 @XmlEnumValue("C") COMPLETE("C"), 031 @XmlEnumValue("A") APPROVE("A"), 032 @XmlEnumValue("K") ACKNOWLEDGE("K"), 033 @XmlEnumValue("F") FYI("F"); 034 035 private final String code; 036 037 ActionRequestType(String code) { 038 this.code = code; 039 } 040 041 @Override 042 public String getCode() { 043 return code; 044 } 045 046 public String getLabel() { 047 return name(); 048 } 049 050 public static ActionRequestType fromCode(String code) { 051 if (code == null) { 052 return null; 053 } 054 for (ActionRequestType request : values()) { 055 if (request.code.equals(code)) { 056 return request; 057 } 058 } 059 throw new IllegalArgumentException("Failed to locate the ActionRequestType with the given code: " + code); 060 } 061 062}