|
|||||||||||||||||||
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 | |||||||||||||||
SelectCommand.java | 0% | 20% | 37,5% | 22,2% |
|
1 |
/*
|
|
2 |
* Replica is published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*/
|
|
5 |
package replica.server.commands.sql;
|
|
6 |
|
|
7 |
import replica.command.CommandProcessor;
|
|
8 |
import replica.core.ApplicationMessage;
|
|
9 |
import replica.server.commands.PrintCommand;
|
|
10 |
import replica.server.mvc.View;
|
|
11 |
|
|
12 |
/**
|
|
13 |
* @author Pedro Costa
|
|
14 |
* @author Helder Silva
|
|
15 |
* @since 20/Jan/2004
|
|
16 |
*/
|
|
17 |
public class SelectCommand extends SqlCommand { |
|
18 |
|
|
19 |
CommandProcessor databaseCommandProcessor; |
|
20 |
CommandProcessor serverCommandProcessor; |
|
21 |
View view; |
|
22 |
|
|
23 |
/**
|
|
24 |
*
|
|
25 |
*/
|
|
26 | 5 |
public SelectCommand() {
|
27 | 5 |
super();
|
28 |
} |
|
29 |
|
|
30 |
/* (non-Javadoc)
|
|
31 |
* @see replica.server.commands.LoggedInCommand#internalExecute(replica.server.ServerCommandVO)
|
|
32 |
*/
|
|
33 | 0 |
protected Object internalExecute(ApplicationMessage appMsg) {
|
34 |
|
|
35 | 0 |
try{
|
36 | 0 |
Object res = getDatabaseCommandProcessor().process( appMsg ); |
37 |
|
|
38 | 0 |
if( !(res instanceof String) ) |
39 | 0 |
res = getView().render( res ).toString(); |
40 |
|
|
41 | 0 |
String resStr = res.toString(); |
42 |
|
|
43 | 0 |
if( resStr.startsWith(PrintCommand.NAME+" ") ) |
44 | 0 |
resStr = resStr.substring(PrintCommand.NAME.length()).trim(); |
45 |
|
|
46 | 0 |
return resStr;
|
47 |
} |
|
48 |
finally{
|
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
/**
|
|
53 |
* @return
|
|
54 |
*/
|
|
55 | 0 |
public View getView() {
|
56 | 0 |
return view;
|
57 |
} |
|
58 |
|
|
59 |
/**
|
|
60 |
* @param view
|
|
61 |
*/
|
|
62 | 3 |
public void setView(View view) { |
63 | 3 |
this.view = view;
|
64 |
} |
|
65 |
|
|
66 |
/**
|
|
67 |
* @return
|
|
68 |
*/
|
|
69 | 0 |
public CommandProcessor getDatabaseCommandProcessor() {
|
70 | 0 |
return databaseCommandProcessor;
|
71 |
} |
|
72 |
|
|
73 |
/**
|
|
74 |
* @param processor
|
|
75 |
*/
|
|
76 | 3 |
public void setDatabaseCommandProcessor(CommandProcessor processor) { |
77 | 3 |
databaseCommandProcessor = processor; |
78 |
} |
|
79 |
|
|
80 |
/**
|
|
81 |
* @return
|
|
82 |
*/
|
|
83 | 0 |
public CommandProcessor getServerCommandProcessor() {
|
84 | 0 |
return serverCommandProcessor;
|
85 |
} |
|
86 |
|
|
87 |
/**
|
|
88 |
* @param processor
|
|
89 |
*/
|
|
90 | 0 |
public void setServerCommandProcessor(CommandProcessor processor) { |
91 | 0 |
serverCommandProcessor = processor; |
92 |
} |
|
93 |
|
|
94 |
} |
|
95 |
|
|