001    /*
002     * Copyright 2011 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     */
016    package org.kuali.kfs.module.purap.util;
017    
018    import java.util.Iterator;
019    import java.util.List;
020    import java.util.Map;
021    
022    import org.apache.commons.lang.enums.Enum;
023    import org.kuali.kfs.module.purap.PurapPropertyConstants;
024    
025    public final class ThresholdField extends Enum {
026    
027        public static final ThresholdField CHART_OF_ACCOUNTS_CODE = new ThresholdField(PurapPropertyConstants.CHART_OF_ACCOUNTS_CODE);
028        public static final ThresholdField ORGANIZATION_CODE = new ThresholdField(PurapPropertyConstants.ORGANIZATION_CODE);
029        public static final ThresholdField ACCOUNT_TYPE_CODE = new ThresholdField(PurapPropertyConstants.ACCOUNT_TYPE_CODE);
030        public static final ThresholdField SUBFUND_GROUP_CODE = new ThresholdField(PurapPropertyConstants.SUB_FUND_GROUP_CODE);
031        public static final ThresholdField FINANCIAL_OBJECT_CODE = new ThresholdField(PurapPropertyConstants.FINANCIAL_OBJECT_CODE);
032        public static final ThresholdField COMMODITY_CODE = new ThresholdField(PurapPropertyConstants.ITEM_COMMODITY_CODE);
033        public static final ThresholdField VENDOR_HEADER_GENERATED_ID = new ThresholdField(PurapPropertyConstants.VENDOR_HEADER_GENERATED_ID);
034        public static final ThresholdField VENDOR_DETAIL_ASSIGNED_ID = new ThresholdField(PurapPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID);
035        public static final ThresholdField VENDOR_NUMBER = new ThresholdField(PurapPropertyConstants.VENDOR_NUMBER,false);
036        public static final ThresholdField ACTIVE = new ThresholdField(PurapPropertyConstants.BO_ACTIVE,true);
037        
038        /**
039         * Indicates that a field is available in DB or not
040         */
041        private boolean isPersistedField;
042        
043        private ThresholdField(String name) {
044            this(name,true);
045        }
046        
047        private ThresholdField(String name,
048                               boolean isPersisitedField) {
049            super(name);
050            this.isPersistedField = isPersisitedField;
051        }
052      
053        public static ThresholdField getEnum(String thresholdEnum) {
054          return (ThresholdField) getEnum(ThresholdField.class, thresholdEnum);
055        }
056      
057        public static Map getEnumMap() {
058          return getEnumMap(ThresholdField.class);
059        }
060      
061        public static List getEnumList() {
062          return getEnumList(ThresholdField.class);
063        }
064      
065        public static Iterator iterator() {
066          return iterator(ThresholdField.class);
067        }
068    
069        public boolean isPersistedField() {
070            return isPersistedField;
071        }
072    }