package com.vci.common.log; /** * 日志类型 * * @author Administrator * */ public enum LogType { /** * 登录 */ Login("Login", "登录", 1), /** * 登出 */ Logout("Logout", "登出", 2), /** * 授权 */ GrantPrivileges("GrantPrivileges", "授权", 3), /** * 一般操作 */ GeneralOperation("GeneralOperation", "一般操作", 4), /** * 集成操作 */ Integration("Integration", "集成操作", 5), /** * 锁定用户 */ LockUser("LockUser", "锁定用户", 6), /** * 解锁用户 */ UnlockUser("UnlockUser", "解锁用户", 7), /** * 卷文件上传 */ VolumnFileUpload("VolumnFileUpload", "卷文件上传", 8), /** * 卷文件下载 */ VolumnFileDownload("VolumnFileDownload", "卷文件下载", 9); private String name = ""; private String label = ""; private int intVal = 1; private LogType(String name, String label, int intVal){ this.name = name; this.label = label; this.intVal = intVal; } public static LogType[] getAll() { return values(); } public static LogType getByName(String name) { LogType res = getByType(LogByType.Name, name); return res; } public static LogType getByLabel(String label) { LogType res = getByType(LogByType.Label, label); return res; } public static LogType getByIntVal(int intVal) { LogType res = getByType(LogByType.IntVal, String.valueOf(intVal)); return res; } public static LogType getByType(LogByType type, String val) { LogType[] alls = getAll(); LogType res = null; for (LogType obj : alls) { if ((type == LogByType.Name) && (obj.getName().equalsIgnoreCase(val))) { res = obj; break; } if ((type == LogByType.Label) && (obj.getLabel().equalsIgnoreCase(val))) { res = obj; break; } if ((type == LogByType.IntVal) && (String.valueOf(obj.getIntVal()).equalsIgnoreCase(val))) { res = obj; break; } } return res; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public int getIntVal() { return intVal; } public void setIntVal(int intVal) { this.intVal = intVal; } }