/* Swisscom Safe Connect Copyright (C) 2014 Swisscom This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.swisscom.safeconnect.model; /** * Created by vadim on 15.07.14. */ public enum PlumberStatus { FAILURE, SUCCESS, VALIDATION_FAILURE, UNKNOWN_USER, TARGET_NOT_FOUND, ALREADY_ACTIVATED, MAX_DEVICES_REACHED, DEVICE_REGISTERED_WITH_ANOTHER_NUMBER, MAX_SMS, INVALID_VOUCHER; public static PlumberStatus fromString(String status) { if (status == null) return FAILURE; if (status.equals("ok")) return SUCCESS; if (status.equals("user_not_connected")) return SUCCESS; if (status.equals("unknown_user")) return UNKNOWN_USER; if (status.equals("validation_fail")) return VALIDATION_FAILURE; if (status.equals("target_not_found")) return TARGET_NOT_FOUND; if (status.equals("already_activated")) return ALREADY_ACTIVATED; if (status.equals("max_devices_reached")) return MAX_DEVICES_REACHED; if (status.equals("same_device_with_another_phone_exists")) return DEVICE_REGISTERED_WITH_ANOTHER_NUMBER; if (status.equals("max_sms")) return MAX_SMS; if (status.equals("invalid_voucher")) return INVALID_VOUCHER; return FAILURE; } }