BrightSide Workbench Full Report + Source Code
org.turro.script.Scripting Class Reference

Static Public Member Functions

static boolean eval (String value)
 
static boolean eval (IContact contact, String value)
 
static boolean evalFor (Object entity, String value)
 
static boolean evalFor (IContact contact, Object entity, String value)
 
static boolean evalFor (IElephantEntity iee, String value)
 
static boolean evalFor (IContact contact, IElephantEntity iee, String value)
 
static String realScript (String script)
 
static String scriptContent (String scriptName)
 
static Script instance ()
 

Static Public Attributes

static final String SCRIPT_FOLDER = "/WEB-INF/elephant/scripts"
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 35 of file Scripting.java.

Member Function Documentation

◆ eval() [1/2]

static boolean org.turro.script.Scripting.eval ( IContact  contact,
String  value 
)
static

Definition at line 41 of file Scripting.java.

41  {
42  return evalFor(contact, null, value);
43  }
static boolean evalFor(Object entity, String value)
Definition: Scripting.java:45
Here is the call graph for this function:

◆ eval() [2/2]

static boolean org.turro.script.Scripting.eval ( String  value)
static

Definition at line 37 of file Scripting.java.

37  {
38  return evalFor((IContact) Application.getUser(), null, value);
39  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evalFor() [1/4]

static boolean org.turro.script.Scripting.evalFor ( IContact  contact,
IElephantEntity  iee,
String  value 
)
static

Definition at line 57 of file Scripting.java.

57  {
58  if(Contacts.isValid(contact)) {
59  Script script = iee == null ? null : iee.getActorScript();
60  if(script == null) {
61  script = instance();
62  }
63  if(script != null) {
64  script.addVariable("user", contact);
65  return script.evalToBoolean(Scripting.realScript(value));
66  }
67  }
68  return false;
69  }
static Script instance()
Definition: Scripting.java:92
Here is the call graph for this function:

◆ evalFor() [2/4]

static boolean org.turro.script.Scripting.evalFor ( IContact  contact,
Object  entity,
String  value 
)
static

Definition at line 49 of file Scripting.java.

49  {
50  return evalFor(contact, Entities.getController(entity), value);
51  }
Here is the call graph for this function:

◆ evalFor() [3/4]

static boolean org.turro.script.Scripting.evalFor ( IElephantEntity  iee,
String  value 
)
static

Definition at line 53 of file Scripting.java.

53  {
54  return evalFor((IContact) Application.getUser(), iee, value);
55  }
Here is the call graph for this function:

◆ evalFor() [4/4]

static boolean org.turro.script.Scripting.evalFor ( Object  entity,
String  value 
)
static

Definition at line 45 of file Scripting.java.

45  {
46  return evalFor((IContact) Application.getUser(), entity, value);
47  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ instance()

static Script org.turro.script.Scripting.instance ( )
static

Definition at line 92 of file Scripting.java.

92  {
93  Script script = new Script();
94  script.addVariable("pfunc", new ProfileFunctions());
95  Instances.cached().byAnnotation(ScriptingFunction.class, IScriptingFunction.class).forEach((iScript) -> {
96  iScript.addFunctions(script);
97  });
98  return script;
99  }
Here is the caller graph for this function:

◆ realScript()

static String org.turro.script.Scripting.realScript ( String  script)
static

Definition at line 75 of file Scripting.java.

75  {
76  if(script.startsWith("file:")) {
77  return Scripting.scriptContent(script.substring(5));
78  } else {
79  return script;
80  }
81  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scriptContent()

static String org.turro.script.Scripting.scriptContent ( String  scriptName)
static

Definition at line 83 of file Scripting.java.

83  {
84  try {
85  String file = ElephantContext.getRealPath(SCRIPT_FOLDER + "/" + scriptName);
86  return Document.from(file).content();
87  } catch (IOException ex) {
88  return null;
89  }
90  }
static final String SCRIPT_FOLDER
Definition: Scripting.java:73
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ SCRIPT_FOLDER

final String org.turro.script.Scripting.SCRIPT_FOLDER = "/WEB-INF/elephant/scripts"
static

Definition at line 73 of file Scripting.java.


The documentation for this class was generated from the following file: