📄 usersmanager.java
字号:
/*
* Created on 2004-8-25
*
* This Class is part of HengNgai Jewelry Group(Panyu)'s Product
*
*/
package com.hnjchina.securityManager;
/**
* @author fm
* User Manager abstract class
*
*
*/
public abstract class UsersManager {
/*
protected int userID;
protected String userName;
protected String userDescription;
protected int userType;
*/
//for use with userType
public static final int TYPE_USER = 0;
public static final int TYPE_GROUP = 250;
public static final int UPDATE_SUCCESSFULLY = 1;
public static final int UPDATE_DATANOTREADY = -1;
public static final int UPDATE_DUPLICATED = -10;
public static final int UPDATE_DBERROR = -20;
/**
*
* @param userName: the name the user user to login
* @return the ID of the user
* @throws SQLException
*/
public abstract int getUserID(String userName);
/**
*
* @param userID: the ID of the user
* @return the name of the user
*/
public abstract String getUserName(int userID);
/**
*
* @param userID: the ID of the user
* @return the full description of the user
*/
public abstract String getUserDescription(int userID);
/**
*
* @param userID: the ID of the user
* @return the full description of the user
*/
public abstract int getType(int userID);
/**
*
* @param userID: the ID of the user
* @return if the the given ID is a user, return true
* else return false
*/
public boolean isUser(int userID){
return (getType(userID) == TYPE_USER);
}
/**
*
* @param userName: the Name of the User
* @return TYPE_USER or TYPE_GROUP
* if your System's userType Tag is not inside this 2,Just Wrap it
*/
public int getType(String userName){
return getType(getUserID(userName));
}
/**
*
* @param userName the Name of the User
* @return the full description of the user
*/
public String getUserDescription(String userName){
return getUserDescription(getUserID(userName));
}
/**
*
* @param userid the ID of the user
* @return the fulfilled user Property class
*/
public abstract PropUser getUserProperty(int userID);
/**
*
* @see #getUserProperty(int)
*/
public PropUser getUserProperty(String userName){
return getUserProperty(getUserID(userName));
}
/**
*
* @param userID ID of the user
* @return the Group IDs that the user belongs to
*/
public abstract int[] getUserGroups(int userID);
public int[] getUserGroups(String userName){
return getUserGroups(getUserID(userName));
}
/**
*
* @param userID the ID of the Group
* @return the user IDs that belongs to the group
*/
public abstract int[] getGroupUsers(int userID);
public int[] getGroupUsers(String userName){
return getGroupUsers(getUserID(userName));
}
/**
*
* @param user the structured that should be filled by you
* @return UPDATE_SUCCESSFULLY if successfully
* UPDATE_DATANOTREADY if necessary information not filled up
* UPDATE_DUPLICATED if duplicated record found
* UPDATE_DBERROR if dbError occur
* fill the user.userID with <=0 will make me generate a valid id for it
*/
public abstract int addUser(PropUser user);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -