Class GlobalsWrapper
java.lang.Object
net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper
Is exposed as GLOBALS to any ReportServer script. This object provides access
to ReportServer functionality by exposing ReportServer services and shortcuts
for scripts to access entities and files from the file system.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecutes the script at the given path.Executes the script at the given path passing on the supplied arguments.Executes a terminal command<T> TfindEntity(Class<T> type, Object id) Tries to find the entity by id.findObject(String objectLocation, Class<? extends Right>... rights) Locates an object and observes the supplied rights.findObjects(String objectLocation, Class<? extends Right>... rights) Searches for objects and observes the supplied rights.<T> List<T> getEntitiesByType(Class<T> type) Returns all entities of a given typeEntityManagerReturns aninvalid reference
EntityManager<any>Returns anof aninvalid reference
Providerinvalid reference
EntityManager<T> TgetInstance(Class<T> type) Requests an instance from theinvalid reference
Injector<T> <any>getProvider(Class<T> type) Requests anfrom theinvalid reference
Providerinvalid reference
Injector<T> TgetRsService(Class<T> type) Deprecated.<T> <any>getRsServiceProvider(Class<T> type) Deprecated.Class<?> Loads a class found in the given .groovy fileloadClasses(String path, List<String> classNames) Loads a list of classes found in the given .groovy filenewInstance(Class<?> clazz) Creates a new instance of the given type using the no-argument constructor.Creates a new instance of the given type using the constructor with the given parameters.Reads in the file at the given pathvoidWrites data into a file
-
Field Details
-
services
-
vars
-
injector
public Injector injector -
injectorProvider
public <any> injectorProvider
-
-
Constructor Details
-
GlobalsWrapper
-
-
Method Details
-
getInstance
Requests an instance from theinvalid reference
Injector- Returns:
- the service
-
getProvider
Requests anfrom theinvalid reference
Providerinvalid reference
Injector- Returns:
- the service
-
getRsService
Deprecated.Requests an instance from theinvalid reference
Injector- Returns:
- the service
- See Also:
-
getRsServiceProvider
Deprecated.Requests anfrom theinvalid reference
Providerinvalid reference
Injector- Returns:
- the service
- See Also:
-
exec
Executes the script at the given path.
Note that if the script contains classes, you can not use these directly. You can use
loadClass(String, String)andloadClasses(String, List)in this case.Refer to the following examples: nested classes and multiple classes.
- Parameters:
path- path to the script- Returns:
- the result of the script execution
- Throws:
ScriptEngineException
-
exec
Executes the script at the given path passing on the supplied arguments.
Note that if the script contains classes, you can not use these directly. You can use
loadClass(String, String)andloadClasses(String, List)in this case.Refer to the following examples: nested classes and multiple classes.
- Parameters:
path- path to the scriptarguments- arguments for the execution- Returns:
- the result of the script execution
- Throws:
ScriptEngineException
-
read
Reads in the file at the given path- Parameters:
identifier- path to file- Returns:
- the result as string
-
loadClass
Loads a class found in the given .groovy file- Parameters:
path- path to the .groovy file.className- the fully qualified name of the desired class. In case the class does not contain a package declaration, you can use the class's name directly.- Returns:
- the loaded class definition
- Throws:
ScriptEngineException- if the class cannot be found or something else went wrong
-
loadClasses
public List<Class<?>> loadClasses(String path, List<String> classNames) throws ScriptEngineException Loads a list of classes found in the given .groovy file- Parameters:
path- path to the .groovy file.classNames- the fully qualified names of the desired classes. In case the classes does not contain a package declaration, you can use the classes' names directly.- Returns:
- the loaded class definitions
- Throws:
ScriptEngineException- if the classes cannot be found or something else went wrong
-
newInstance
Creates a new instance of the given type using the no-argument constructor.- Parameters:
clazz- the type of the object to instantiate- Returns:
- a new instance of the given type
- Throws:
ScriptEngineException- if something went wrong during instantiation
-
newInstance
public Object newInstance(Class<?> clazz, List<Class<?>> types, List<Object> params) throws ScriptEngineException Creates a new instance of the given type using the constructor with the given parameters.- Parameters:
clazz- the type of the object to instantiatetypes- the types of the constructor parametersparams- the values of the constructor parameters- Returns:
- a new instance of the given type
- Throws:
ScriptEngineException- if something went wrong during instantiation
-
write
Writes data into a file -
findEntity
Tries to find the entity by id. -
getEntitiesByType
Returns all entities of a given type -
getEntityManager
public EntityManager getEntityManager()Returns aninvalid reference
EntityManager -
getEntityManagerProvider
public <any> getEntityManagerProvider()Returns anof aninvalid reference
Providerinvalid reference
EntityManager -
execCmd
Executes a terminal command- Throws:
TerminalException
-
findObject
public Object findObject(String objectLocation, Class<? extends Right>... rights) throws ObjectResolverException Locates an object and observes the supplied rights.- Throws:
ObjectResolverException
-
findObjects
public Collection<Object> findObjects(String objectLocation, Class<? extends Right>... rights) throws ObjectResolverException Searches for objects and observes the supplied rights.- Throws:
ObjectResolverException
-