Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package edu.ncsu.csc.itrust.action;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
* Handles Getting the person's name associated with a certain mid Used by getUser.jsp
*
*
*/
public class GetUserNameAction {
private DAOFactory factory;
/**
* Set up defaults
*
* @param factory The DAOFactory used for creating the DAOs for this action.
*/
public GetUserNameAction(DAOFactory factory) {
this.factory = factory;
}
/**
* Returns the person's name that matches the inputMID param
*
* @param inputMID The MID to look up.
* @return the person's name
* @throws DBException
* @throws ITrustException
*/
public String getUserName(String inputMID) throws ITrustException {
try {
long mid = Long.valueOf(inputMID);
return factory.getAuthDAO().getUserName(mid);
} catch (NumberFormatException e) {
throw new ITrustException("MID not in correct form");
}
}
}