|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LoggedInCommand.java | 0% | 20% | 33,3% | 20% |
|
1 |
/*
|
|
2 |
* Replica is published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*/
|
|
5 |
package replica.server.commands;
|
|
6 |
|
|
7 |
import replica.core.*;
|
|
8 |
import replica.core.ApplicationMessage;
|
|
9 |
|
|
10 |
/**
|
|
11 |
* This command is extended by all server commands that require that the
|
|
12 |
* user is logged in.
|
|
13 |
*
|
|
14 |
* @author Pedro Costa
|
|
15 |
* @author Helder Silva
|
|
16 |
* @since 20/Jan/2004
|
|
17 |
*/
|
|
18 |
public abstract class LoggedInCommand extends ApplicationCommand { |
|
19 |
|
|
20 |
/**
|
|
21 |
*
|
|
22 |
*/
|
|
23 | 8 |
public LoggedInCommand() {
|
24 | 8 |
super();
|
25 |
} |
|
26 |
|
|
27 |
/* (non-Javadoc)
|
|
28 |
* @see replica.server.commands.ServerCommand#execute(replica.server.ServerCommandVO)
|
|
29 |
*/
|
|
30 | 0 |
protected Object execute(ApplicationMessage arg) {
|
31 |
|
|
32 | 0 |
if( isLoggedIn(arg) ){
|
33 | 0 |
return internalExecute(arg);
|
34 |
} |
|
35 |
|
|
36 | 0 |
return "Not Logged In."; |
37 |
} |
|
38 |
|
|
39 |
/**
|
|
40 |
* Checks that the user is logged in.
|
|
41 |
*
|
|
42 |
* @param arg
|
|
43 |
* @return
|
|
44 |
*/
|
|
45 | 0 |
protected boolean isLoggedIn(ApplicationMessage arg ){ |
46 |
|
|
47 | 0 |
return getSessionManager().getSession(arg.getSessionID()).isLoggedIn();
|
48 |
} |
|
49 |
|
|
50 |
protected abstract Object internalExecute(ApplicationMessage arg);
|
|
51 |
} |
|
52 |
|
|