public class ScriptEnginePersonAttributeDao extends BasePersonAttributeDao
The script must also return an attribute named username.
A sample script implementation in Groovy follows:
import java.util.*
def Map<String, List<Object>> run(final Object... args) {
def uid = args[0]
def logger = args[1]
return[username:[uid], likes:["cheese", "food"], id:[1234,2,3,4,5], another:"attribute"]
}
For the script engine to do its job, relevant libraries must be available on the classpath. Options include groovy, python and javascript libraries. The script type is determined by script file extension.
| Modifier and Type | Class and Description |
|---|---|
static class |
ScriptEnginePersonAttributeDao.SCRIPT_TYPE |
WILDCARD, WILDCARD_PATTERN| Constructor and Description |
|---|
ScriptEnginePersonAttributeDao()
This should probably be deprecated in favor of constructors that guarantee required properties are set
|
ScriptEnginePersonAttributeDao(java.lang.String scriptFile)
Create DAO with reference to file or the contents of a script.
|
ScriptEnginePersonAttributeDao(java.lang.String scriptFile,
java.lang.String engineName)
Create DAO with reference to file or the contents of a script.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.String> |
getAvailableQueryAttributes() |
java.lang.String |
getEngineName() |
java.util.Set<IPersonAttributes> |
getPeople(java.util.Map<java.lang.String,java.lang.Object> query) |
java.util.Set<IPersonAttributes> |
getPeopleWithMultivaluedAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> query) |
IPersonAttributes |
getPerson(java.lang.String uid) |
java.util.Set<java.lang.String> |
getPossibleUserAttributeNames() |
static java.lang.String |
getScriptEngineName(java.lang.String filename)
This method is static is available as utility for users that are passing the contents of a script
and want to set the engineName property based on a filename.
|
java.lang.String |
getScriptFile() |
protected ScriptEnginePersonAttributeDao.SCRIPT_TYPE |
getScriptType() |
boolean |
isCaseInsensitiveUsername() |
void |
setCaseInsensitiveUsername(boolean caseInsensitiveUsername) |
void |
setEngineName(java.lang.String engineName) |
void |
setScriptFile(java.lang.String scriptFile) |
compareTo, flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getOrder, getUserAttributes, getUserAttributes, setOrderpublic ScriptEnginePersonAttributeDao()
public ScriptEnginePersonAttributeDao(java.lang.String scriptFile)
scriptFile - This can be a path to a file, classpath resource, or the script contents as string.
If its the string version then engine name must be set using setter.public ScriptEnginePersonAttributeDao(java.lang.String scriptFile,
java.lang.String engineName)
scriptFile - This can be a path to a file, classpath resource, or the script contents as string.
If its the string version then engine name must be set using setter.engineName - Script engine name such as js, groovy, pythonpublic java.lang.String getScriptFile()
public void setScriptFile(java.lang.String scriptFile)
public java.lang.String getEngineName()
protected ScriptEnginePersonAttributeDao.SCRIPT_TYPE getScriptType()
public void setEngineName(java.lang.String engineName)
public boolean isCaseInsensitiveUsername()
public void setCaseInsensitiveUsername(boolean caseInsensitiveUsername)
public IPersonAttributes getPerson(java.lang.String uid)
public java.util.Set<IPersonAttributes> getPeople(java.util.Map<java.lang.String,java.lang.Object> query)
public java.util.Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> query)
public java.util.Set<java.lang.String> getPossibleUserAttributeNames()
public java.util.Set<java.lang.String> getAvailableQueryAttributes()
public static java.lang.String getScriptEngineName(java.lang.String filename)
filename - Copyright © 2005-2018. All Rights Reserved.