001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.license.messaging;
016    
017    /**
018     * @author Igor Beslic
019     */
020    public enum LCSPortletState {
021    
022            GOOD(1), NO_AVAILABLE_SERVERS(2), NO_CONNECTION(3), NOT_REGISTERED(5),
023            NO_SUBSCRIPTION(4), PLUGIN_ABSENT(0), UNDEFINED(Integer.MAX_VALUE);
024    
025            public static LCSPortletState valueOf(int intValue) {
026                    if (intValue == 0) {
027                            return PLUGIN_ABSENT;
028                    }
029                    else if (intValue == 1) {
030                            return GOOD;
031                    }
032                    else if (intValue == 2) {
033                            return NO_AVAILABLE_SERVERS;
034                    }
035                    else if (intValue == 3) {
036                            return NO_CONNECTION;
037                    }
038                    else if (intValue == 4) {
039                            return NO_SUBSCRIPTION;
040                    }
041                    else if (intValue == 5) {
042                            return NOT_REGISTERED;
043                    }
044    
045                    return UNDEFINED;
046            }
047    
048            public int intValue() {
049                    return _state;
050            }
051    
052            private LCSPortletState(int state) {
053                    _state = state;
054            }
055    
056            private final int _state;
057    
058    }