⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorcode.java

📁 菲律宾的一个大学的图书管理系统 spring+hibernate+velocity
💻 JAVA
字号:
/*
 * 创建日期 2005-4-6
 */
package biz.bluesky.pts.util;

import java.util.*;

public class ErrorCode {
    
    public static final int ERR_ROLE_EMPTY = -1000; //角色名为空
    public static final int ERR_TEACHER_EMPTY = -1001;//教师名称为空
    public static final int ERR_SCHOOL_EMPTY = -1002;//学校名称为空
    public static final int ERR_SUBJECT_EMPTY = -1003;//科目为空
    public static final int ERR_CLASS_EMPTY = -1004;//班级为空
    public static final int ERR_TEST_EMPTY = -1005;//测试为空
    public static final int ERR_ACADEMICYEAR_EMPTY = -1006;//学年为空
    public static final int ERR_REMARK_EMPTY = -1007; //评语为空
    public static final int ERR_LEVEL_EMPTY = -1008;//级别为空
    public static final int ERR_STREAM_EMPTY = -1009;//流为空
    public static final int ERR_CASA_EMPTY = -1010;//CaSa为空
    
    public static final int ERR_ROLE_REPEAT = -2000; //角色名称重复
    public static final int ERR_TEACHER_REPEAT = -2001;//教师名称重复
    public static final int ERR_SCHOOL_REPEAT = -2002;//学校重复
    public static final int ERR_SUBJECT_REPEAT = -2003;//科目重复
    public static final int ERR_CLASS_REPEAT = -2004;//班级重复
    public static final int ERR_TEST_REPEAT = -2005;//测试重复
    public static final int ERR_ACADEMICYEAR_REPEAT = -2006;//学年重复
    public static final int ERR_REMARK_REPEAT = -2007; //评语重复
    public static final int ERR_LEVEL_REPEAT = -2008; //级别重复
    public static final int ERR_STREAM_REPEAT = -2009;//流重复
    public static final int ERR_CASA_REPEAT = -2010;//CaSa重复
    
    public static final int ERR_ROLE_NOT_FIND = -3000;//角色不存在
    public static final int ERR_TEACHER_NOT_FIND = -3001;//教师不存在
    public static final int ERR_SCHOOL_NOT_FIND = -3002;//学校不存在
    public static final int ERR_SUBJECT_NOT_FIND = - 3003;//科目未发现
    public static final int ERR_CLASS_NOT_FIND = -3004;//班级未发现
    public static final int ERR_TEST_NOT_FIND = -3005;//测试未发现
    public static final int ERR_ACADEMICYEAR_NOT_FIND = -3006;//学年未发现
    public static final int ERR_REMARK_NOT_FIND = -3007; //评语未发现
    public static final int ERR_LEVEL_NOT_FIND = -3008; //级别未发现
    public static final int ERR_STREAM_NOT_FIND = -3009;//流未发现
    public static final int ERR_CASA_NOT_FIND = -3010;//CaSa未发现

    
    public static final int ERR_ROLE_PERMISSION_RELATETIONSHIP_NOT_FIND = -3100;//角色权限关系不存在
    public static final int ERR_ROLE_TEACHER_RELATETIONSHIP_NOT_FIND = -3101;//角色教师关系不存在
    public static final int ERR_TEACHER_SUBJECT_RELATETIONSHIP_NOT_FIND = -3102;//教师科目关系不存在
    public static final int ERR_CLASS_TEST_RELATETIONSHIP_NOT_FIND = -3103;//班级测试关系不存在
    public static final int ERR_TEACHER_CLASS_RELATETIONSHIP_NOT_FIND = -31004;//教师班级关系不存在
    
    public static final int ERR_ADD_ROLE_PERMISSION_RELATETIONSHIP = -4000;//增加角色权限关系出错
    public static final int ERR_ADD_ROLE_TEACHER_RELATETIONSHIP = -4001;//增加教师角色关系出错
    public static final int ERR_ADD_TEACHER_SUBJECT_RELATETIONSHIP = -4002;//增加教师科目关系出错 
    public static final int ERR_ADD_CLASS_TEST_RELATIONSHIP = -4003;//增加班级测试关系出错
    public static final int ERR_ADD_TEACHER_CLASS_RELATETIONSHIP = -4004;//增加教师班级关系出错
    
    public static final int ERR_ROLE_EXIST_PERMISSIOIN = -5000;//角色具有权限
    public static final int ERR_TEST_YEAR_EXCEPTION = -5001;//测试年份异常

    
    
    
    public static final int ERR_UNDISCOVERED = -10000; //未发现错误
    public static final int ERR_UNKNOW = -20000;
    
    public static final int TEST_YEAR_LOWER = 2004;//测试年份下限
    public static final int TEST_YEAR_UPPER = 3000;//测试年份上限

    public static Map map = new HashMap();
    
    static{
    	map.put(new Integer(ERR_ROLE_EMPTY),"The role name is null.");
    	map.put(new Integer(ERR_TEACHER_EMPTY),"The teacher name is null.");
    	map.put(new Integer(ERR_SCHOOL_EMPTY),"The school name is null.");
    	map.put(new Integer(ERR_SUBJECT_EMPTY),"The subject name is null.");
    	map.put(new Integer(ERR_CLASS_EMPTY),"The class name is null.");
    	map.put(new Integer(ERR_TEST_EMPTY),"The test name is null.");
    	
    	map.put(new Integer(ERR_ROLE_REPEAT),"The role is exist.");
    	map.put(new Integer(ERR_TEACHER_REPEAT),"The teacher is exist.");
    	map.put(new Integer(ERR_SCHOOL_REPEAT),"The school is exist.");
    	map.put(new Integer(ERR_SUBJECT_REPEAT),"The subject is exist.");
    	map.put(new Integer(ERR_CLASS_REPEAT),"The class is exist.");
    	map.put(new Integer(ERR_TEST_REPEAT),"The test is exist.");
    	
    	map.put(new Integer(ERR_ROLE_NOT_FIND),"The role isn't exist.");
    	map.put(new Integer(ERR_TEACHER_NOT_FIND),"The teacher isn't exist.");
    	map.put(new Integer(ERR_SCHOOL_NOT_FIND),"The school isn't exist.");
    	map.put(new Integer(ERR_SUBJECT_NOT_FIND),"The subject isn't exist.");
    	map.put(new Integer(ERR_CLASS_NOT_FIND),"The class isn't exist.");
    	map.put(new Integer(ERR_TEST_NOT_FIND),"The test isn't exist.");
    	
    	map.put(new Integer(ERR_ROLE_PERMISSION_RELATETIONSHIP_NOT_FIND),"The relationship is not found.");
    	map.put(new Integer(ERR_ROLE_TEACHER_RELATETIONSHIP_NOT_FIND),"The relationship is not found.");
    	map.put(new Integer(ERR_TEACHER_SUBJECT_RELATETIONSHIP_NOT_FIND),"The relationship is not found.");
    	map.put(new Integer(ERR_CLASS_TEST_RELATETIONSHIP_NOT_FIND),"The relationship is not found.");
    	map.put(new Integer(ERR_TEACHER_CLASS_RELATETIONSHIP_NOT_FIND),"The relationship is not found.");
    	
    	map.put(new Integer(ERR_ADD_ROLE_PERMISSION_RELATETIONSHIP),"Failed to add role-permission relationship.");
    	map.put(new Integer(ERR_ADD_ROLE_TEACHER_RELATETIONSHIP),"Failed to add role-teacher relationship.");
    	map.put(new Integer(ERR_ADD_TEACHER_SUBJECT_RELATETIONSHIP),"Failed to add teacher-subject relationship.");
    	map.put(new Integer(ERR_ADD_CLASS_TEST_RELATIONSHIP),"Failed to add class-test relationship.");
    	map.put(new Integer(ERR_ADD_TEACHER_CLASS_RELATETIONSHIP),"Failed to add teacher-class relationship.");
    	
    	map.put(new Integer(ERR_ROLE_EXIST_PERMISSIOIN),"The role has the permission.");
    	map.put(new Integer(ERR_TEST_YEAR_EXCEPTION),"Invalid test year.");
    	
    	map.put(new Integer(ERR_REMARK_EMPTY),"评语为空");
    	map.put(new Integer(ERR_REMARK_REPEAT),"评语重复");
    	map.put(new Integer(ERR_REMARK_NOT_FIND),"评语没有找到");
    	
    	map.put(new Integer(ERR_UNKNOW),"Unknow error.");
    	map.put(new Integer(TEST_YEAR_LOWER),"The min test year.");
    	map.put(new Integer(TEST_YEAR_UPPER),"The max test year.");
    	
    	map.put(new Integer(ERR_UNDISCOVERED),"successful");
    
    	
    }
    
    public static String getErrorMessage(int errorCode){
    	String msg = (String)map.get(new Integer(errorCode));
    	return msg;
    }
    
    public static void main(String[]args){    	
      String ms =	ErrorCode.getErrorMessage(-1002);
       System.out.println(ms);
    }    

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -