📄 profilemanager.java
字号:
package com.gs.db;
import java.util.*;
/**
* Manages Users, Groups and Units
*/
public interface ProfileManager {
/**
* Factory method for creating a new User. A password, email address, and
* unique username are all required fields to create a new User.
*
* @param username the new and unique username for the account.
* @param password the password for the account as plain text.
* @param email the email address for the account.
* @return a new User.
* @throws UserAlreadyExistsException if the username already exists in
* the system.
*/
public User createUser(String username, String password, String email)
throws UserAlreadyExistsException;
/**
* Factory method for creating a new Group. A unique name is the only
* required field.
*
* @param name the new and unique name for the group.
* @return a new Group.
* @throws GroupAlreadyExistsException if the group name already exists in
* the system.
*/
public Group createGroup(String name) throws UnauthorizedException,
GroupAlreadyExistsException;
/**
* Factory method for creating a new Group associated with a certain unit.
*
* @param name the new and unique name for the group.
* @param unit the unit to asscociate with
* @param priority the priority level assigned to the group
* @return a new Group.
* @throws GroupAlreadyExistsException if the group name already exists in
* the system.
*/
public Group createGroup(String name, Unit unit, int priority) throws UnauthorizedException,
GroupAlreadyExistsException ;
/**
* Returns a User specified by their id.
*
* @param userid the id of the User to lookup.
* @return the User specified by the given id.
* @throws UserNotFoundException if the user does not exist.
*/
public User getUser(int userID) throws UserNotFoundException;
/**
* Returns a User specified by username.
*
* throws UserNotFoundException if the user does not exist.
*/
public User getUser(String username) throws UserNotFoundException;
/**
* Returns the special "anonymous user" object.
*/
public User getAnonymousUser();
/**
* Returns the "special user" object. The special user represents any
* valid user in the system. Getting a handle on this object is only
* really useful for setting permissions. For example, if you
* want to allow any registered user to post news, add
* a user permission for posting messages with the special user as the
* User parameter.
*/
public User getSpecialUser();
/**
* Gets a Group by ID.
*
* throws GroupNotFoundException if the group does not exist.
*/
public Group getGroup(int groupID) throws GroupNotFoundException;
/**
* Gets a Group by name.
*
* throws GroupNotFoundException if the group does not exist.
*/
public Group getGroup(String name) throws GroupNotFoundException;
/**
* Deletes a User.
*
* @param user the user to delete.
* @throws UnauthorizedException
*/
public void deleteUser(User user) throws UnauthorizedException;
/**
* Deletes a Group.
*
* @param group the group to delete.
* @throws UnauthorizedException
*/
public void deleteGroup(Group group) throws UnauthorizedException;
/**
* Returns the numer of users in the system.
*/
public int getUserCount();
/**
* Returns the number of groups in the system.
*/
public int getGroupCount();
/**
* Retruns an iterator for all users.
*/
public Iterator users();
/**
* Returns an iterator for all users starting at startIndex with the
* given number of results. This is useful to support pagination in a GUI
* where you may only want to display a certain number of results per page.
* It is possible that the number of results returned will be less than
* that specified by numResults if numResults is greater than the number
* of records left in the system to display.
*
* @param startIndex the beginning index to start the results at.
* @param numResults the total number of results to return.
* @return an Iterator for all users in the specified range.
*/
public Iterator users(int startIndex, int numResults);
/**
* Returns an iterator for all groups in the system.
*
* @return an Iterator for all groups.
*/
public Iterator groups();
/**
* Returns an iterator for all groups starting at startIndex with the
* given number of results. This is useful to support pagination in a GUI
* where you may only want to display a certain number of results per page.
* It is possible that the number of results returned will be less than
* that specified by numResults if numResults is greater than the number
* of records left in the system to display.
*
* @param startIndex the beginning index to start the results at.
* @param numResults the total number of results to return.
* @return an Iterator for all groups in the specified range.
*/
public Iterator groups(int startIndex, int numResults);
/**
* Return the root unit of whole organization hierachy
* @return an Unit object represents the root unit
*/
public Unit getRootUnit();
/**
* Gets a Unit by ID.
*
* throws UnitNotFoundException if the group does not exist.
* @see Unit
*/
public Unit getUnit( String unitID ) throws UnitNotFoundException;
/**
* Factory method for creating a new Unit. A parent unit and a unique name
* under the parent unit are required fields.
*
* @param parent the Unit which the new Unit directly belongs to
* @param name the new and unique name among sibling units
* @return a new Unit.
* @throws UnitCreationFailureExceptionException if fails
*/
public Unit createUnit( Unit parent, String newUnitID,String unitName,String phone,String lxr,String inside) throws
UnauthorizedException, UnitCreationFailureException ;
/**
* Delete the unit. This operation will automatically delete all the subunits
* recursively.
*
* @param unit the Unit to be deleted
* @throws UnauthorizedException if it does not have the permission
*/
public void deleteUnit( Unit unit ) throws UnauthorizedException ;
/**
* Find all the group not linked with any unit
*
* @return the IDs of the Groups
*/
public int[] getUnitFreeGroups();
/**
* Get a list of all existing units
*
* @return the IDs of the existing units
*/
public String[] getAllUnits();//得到所有的单位
public HashMap getOutSideUnits();//得到所有的外部单位
/**
*得到某一用户所在的组
* Get ids of all the groups who contains the specified user
*
* @param userid represents the specified user
* @return the array of group-ids
*
* (Sorry for the poor function name, someone's Java is much better
* than his English)
*/
public int[] getGroupsExistUserID(int userid);
public ArrayList getGroupsExistUserID_new(int userid);
/**
*得到该用户所在的单位
* Get ids of all the units who contains the specified user
*
* @return the array of unit-ids
* @param userid represents the specified user
*/
public Unit[] getUnitsExistUserID(int userid);
public ArrayList getUnitsExistUserID_new(int userid);
/**
*得到我的下属用户(在同一单位或下级单位)
* Find all the users under the charge of the specified user
*
* @param userid represents the specified user
* @return the array of user-ids
*/
public int[] getUnderUsers(int userid);
/**
* 得到我属于高级负责人的单位
* Find all the units in which the given user is manager
*
* @param userid represents the specified user
* @return the array of unit-ids
*/
public Unit[] getUnitsExistManager(int userid);
public ArrayList getUnitsExistManager_new(int userid);
/**
* 得到某一单位下的属于我管理的用户(在同一单位)
* Find all the users under the charge of the given user and
* belonging to the same unit of the given user.<p> This function
* is specially developed for the Project of China Telecom case.
*
* @param userid represents the given user
* @return the array of user-ids
*/
public User[] getUnderUsers_byunit(int userid,String unitid);
/**
* 得到某一单位下的属于我管理的用户(在同一单位)
* Find all the users under the charge of the given user and
* belonging to any sub unit of the given unit. <p> This function
* is specially developed for the Project of China Telecom case.
*
* @param userid represents the given user
* @param unitid represents the given unit
* @return the array of user-ids
*/
public int[] getUnderUsers_bysubunit(int userid,String unitid);//得到某一单位下属的子单位的属于我管理的用户
/**
* Test if the given user has the given priority level in the given unit.
*
* @param userid the given user
* @param unitid the given unit
* @param PRI the given priority level, from 0(h) to 2 (l)
* @return true or false
*/
public boolean isPrincipalInUnit(int userid,String unitid,int PRI);
/**
* Get all the email addresses of the given users
*
* @param userIDs represents the given users
* @return the array of e-mail addresses correspondingly
*/
public String[] getEmails_byUserID(int[] userIDs);
public ArrayList getAllUsers_byUnit(String unitID);
public ArrayList getAllInsideUsers_byUnit(String unitID);
public User[] getAllUserInUnitFormLevel(String unitid, int level);
public User[] getUserInUnitFormLevel(String unitid, int level);
public Properties getTopPriAndUnit(int userid) ;
public boolean isSupervisor(String unitid, int userid,int level);
public boolean isSupervisor(String unitid, int userid);
public String[] getUnDoByCLR(String clr,String gxdw,String cldw,String type);
public String[] getUnDoByType(String gxdw,String cldw,String type);
public String[] getUnDoByType2(String gxdw,String cldw,String type);
public String[] getUnDoDjs(String gxdw,String cldw);
public String[] getUserDjByTypeAndStatus(String type,String userID);
public String[] getDoingByTypeForSupervisor(String type,String gxdw,String supervisorID);
public ArrayList getUnFinishedList(String djjg,String cldw);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -