svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / programming / UserFunction.java @ 47017
History | View | Annotate | Download (983 Bytes)
1 | 44138 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.programming; |
---|---|---|---|
2 | 43512 | jjdelcerro | |
3 | import org.apache.commons.lang3.Range; |
||
4 | 43939 | jjdelcerro | import org.gvsig.expressionevaluator.Function; |
5 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
6 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
7 | 44338 | jjdelcerro | import org.gvsig.tools.ToolsLocator; |
8 | 43512 | jjdelcerro | |
9 | 44338 | jjdelcerro | public class UserFunction extends AbstractFunction { |
10 | 43512 | jjdelcerro | |
11 | 44338 | jjdelcerro | public static final String NAME = "USER"; |
12 | 44138 | jjdelcerro | |
13 | 44338 | jjdelcerro | public UserFunction() {
|
14 | 44138 | jjdelcerro | super(Function.GROUP_PROGRAMMING,
|
15 | NAME, |
||
16 | 44338 | jjdelcerro | Range.is(0),
|
17 | "Get the current user logged.",
|
||
18 | NAME+"()",
|
||
19 | null,
|
||
20 | "SimpleIdentity",
|
||
21 | 44098 | jjdelcerro | false
|
22 | ); |
||
23 | 44338 | jjdelcerro | this.addAlias("CURRENTUSER"); |
24 | 43512 | jjdelcerro | } |
25 | 44138 | jjdelcerro | |
26 | 43512 | jjdelcerro | @Override
|
27 | 44138 | jjdelcerro | public boolean allowConstantFolding() { |
28 | return false; |
||
29 | } |
||
30 | |||
31 | @Override
|
||
32 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) throws Exception { |
33 | 44338 | jjdelcerro | return ToolsLocator.getIdentityManager().getCurrentIdentity();
|
34 | 43512 | jjdelcerro | } |
35 | |||
36 | } |