Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.data
Class Script

java.lang.Object
  extended by ch.elexis.data.PersistentObject
      extended by ch.elexis.data.NamedBlob2
          extended by ch.elexis.data.Script
All Implemented Interfaces:
IPersistentObject, ISelectable

public class Script
extends NamedBlob2

A script. At this moment only beanshell is supported as interpreter, but others are possible

Author:
gerry

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.elexis.data.PersistentObject
PersistentObject.FieldType
 
Field Summary
static java.lang.String INTERPRETER_BEANSHELL
           
static java.lang.String INTERPRETER_DEFAULT
           
static java.lang.String INTERPRETER_SCALA
           
static java.lang.String SCRIPT_MARKER
           
 
Fields inherited from class ch.elexis.data.NamedBlob2
FLD_CONTENTS, FLD_DATUM, TABLENAME
 
Fields inherited from class ch.elexis.data.PersistentObject
CACHE_DEFAULT_LIFETIME, CACHE_MIN_LIFETIME, CFG_CONNECTSTRING, CFG_DRIVER, CFG_PWD, CFG_TYPE, CFG_USER, DELETED, EXISTS, INEXISTENT, INVALID_ID, MATCH_AUTO, MATCH_CONTAINS, MATCH_EXACT, MATCH_REGEXP, MATCH_START
 
Fields inherited from interface ch.elexis.core.data.IPersistentObject
FLD_DATE, FLD_DELETED, FLD_EXTINFO, FLD_ID, FLD_LASTUPDATE, STATE_EXISTING, STATE_INEXISTENT, STATE_INVALID_ID
 
Method Summary
static Script create(java.lang.String name, java.lang.String contents)
           
static java.lang.Object execute(Interpreter scripter, java.lang.String script, java.lang.String params, PersistentObject... objects)
          execute a script entered as string with the given interpreter
 java.lang.Object execute(java.lang.String params, PersistentObject... objects)
           
static java.lang.Object executeScript(java.lang.String call, PersistentObject... objects)
          Execute a script that is part of the call
 void finished()
           
static Interpreter getInterpreterFor(java.lang.String script)
           
 java.lang.String getLabel()
          Einen menschenlesbaren Identifikationsstring für dieses Objet liefern
static java.util.List<Script> getScripts()
           
static Script importFromFile(java.lang.String filepath)
           
 void init()
           
 boolean isDragOK()
          Darf dieses Objekt mit Drag&Drop verschoben werden?
 boolean isValid()
          Angeben, ob dieses Objekt gültig ist.
static Script load(java.lang.String id)
           
 void setVariable(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class ch.elexis.data.NamedBlob2
cleanup, create, getBytes, getHashtable, getString, put, putBytes, putString
 
Methods inherited from class ch.elexis.data.PersistentObject
addChangeListener, addSticker, addToList, addXid, begin, checkNull, checkZero, checkZeroDouble, clearCache, connect, connect, delete, deleteList, disconnect, equals, executeSQLScript, exists, exportData, fireChangeEvent, flatten, fold, get, get, getCacheTime, getConnection, getDefaultCacheLifetime, getFieldType, getId, getInt, getLastUpdate, getList, getList, getMap, getSticker, getStickers, getWrappedId, getXid, getXid, getXids, hashCode, isAvailable, isDeleted, isMatching, isMatching, isMatching, isMatching, isShowDeleted, lock, map, relock, removeChangeListener, removeFromList, removeFromList, removeSticker, resetCache, set, set, setDefaultCacheLifetime, setInt, setMap, setShowDeleted, setTrace, state, storeToString, tableExists, ts, undelete, unlock
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERPRETER_BEANSHELL

public static final java.lang.String INTERPRETER_BEANSHELL
See Also:
Constant Field Values

INTERPRETER_SCALA

public static final java.lang.String INTERPRETER_SCALA
See Also:
Constant Field Values

INTERPRETER_DEFAULT

public static final java.lang.String INTERPRETER_DEFAULT
See Also:
Constant Field Values

SCRIPT_MARKER

public static final java.lang.String SCRIPT_MARKER
See Also:
Constant Field Values
Method Detail

create

public static Script create(java.lang.String name,
                            java.lang.String contents)
                     throws ElexisException
Throws:
ElexisException

getLabel

public java.lang.String getLabel()
Description copied from class: PersistentObject
Einen menschenlesbaren Identifikationsstring für dieses Objet liefern

Specified by:
getLabel in interface IPersistentObject
Overrides:
getLabel in class NamedBlob2

init

public void init()
          throws ElexisException
Throws:
ElexisException

finished

public void finished()
              throws ElexisException
Throws:
ElexisException

setVariable

public void setVariable(java.lang.String name,
                        java.lang.Object value)
                 throws ElexisException
Throws:
ElexisException

execute

public static java.lang.Object execute(Interpreter scripter,
                                       java.lang.String script,
                                       java.lang.String params,
                                       PersistentObject... objects)
                                throws ElexisException
execute a script entered as string with the given interpreter

Parameters:
objects - optional Objects to replace in Variables like [Fall.Grund] in the script
params - optional parameters. These can be of the form name=value or value. if no name is given, the variables will be inserted for $1, $2 ... in the script. If a name is given, $names in the script will be replaced with the respective values.
Returns:
The result of the script interpreter
Throws:
ElexisException

execute

public java.lang.Object execute(java.lang.String params,
                                PersistentObject... objects)
                         throws ElexisException
Throws:
ElexisException

getScripts

public static java.util.List<Script> getScripts()

executeScript

public static java.lang.Object executeScript(java.lang.String call,
                                             PersistentObject... objects)
                                      throws ElexisException
Execute a script that is part of the call

Parameters:
call - e.g. scriptname(a="foo",b="bar")
objects - some Objects to cinvert in the script
Returns:
the result of the interpreter
Throws:
ElexisException - if no such scruiopt was found or an error occurred

isDragOK

public boolean isDragOK()
Description copied from class: PersistentObject
Darf dieses Objekt mit Drag&Drop verschoben werden?

Specified by:
isDragOK in interface IPersistentObject
Overrides:
isDragOK in class PersistentObject
Returns:
true wenn ja.

isValid

public boolean isValid()
Description copied from class: PersistentObject
Angeben, ob dieses Objekt gültig ist.

Specified by:
isValid in interface IPersistentObject
Overrides:
isValid in class PersistentObject
Returns:
true wenn die Daten gültig (nicht notwendigerweise korrekt) sind

load

public static Script load(java.lang.String id)

getInterpreterFor

public static Interpreter getInterpreterFor(java.lang.String script)
                                     throws ElexisException
Throws:
ElexisException

importFromFile

public static Script importFromFile(java.lang.String filepath)
                             throws ElexisException
Throws:
ElexisException

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis