All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.development.persistence.UserStatus Maven / Gradle / Ivy

The newest version!
package com.jelastic.api.development.persistence;

/**
 *
 * @author Ruslan Sinitskiy
 */
public enum UserStatus {

    ENABLED(0), SUSPENDED(1);
    private int id;

    UserStatus(int id) {
        this.id = id;
    }

    public static final UserStatus get(String status) {
        if (status == null) {
            return null;
        }
        int id = -1;
        if (status.equalsIgnoreCase(ENABLED.toString())) {
            id = 0;
        } else if (status.equalsIgnoreCase(SUSPENDED.toString())) {
            id = 1;
        } else {
            try {
                id = Integer.parseInt(status);
            } catch (Exception ex) {
                return null;
            }
        }
        return get(id);
    }

    public static final UserStatus get(int id) {
        switch (id) {
            case 0:
                return ENABLED;
            case 1:
                return SUSPENDED;
            default:
                return null;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy