com.tle.common.scripting.objects
Interface UtilsScriptObject
Declaration: public interface UtilsScriptObject extends ScriptObject
All Superinterfaces: ScriptObject, java.io.Serializable

 

Referenced by the 'utils' variable in script

 

 

Fields Summary
static java.lang.String DEFAULT_VARIABLE
    

 

 

Methods Summary
abstract java.util.List<FacetCountResultScriptType> facetCount(java.lang.String query, java.lang.String[] collectionUuids, java.lang.String where, java.lang.String facetXpath)
    
Retrieves a list of terms and item counts for an XPath.
abstract CollectionScriptType getCollectionFromUuid(java.lang.String collectionUuid)
    
Return a CollectionScriptType object based on the collectionUuid.
abstract ConnectionScriptType getConnection(java.lang.String url)
    
Starts a connection with the site at URL.
abstract java.util.Date getDate(java.lang.String date, java.lang.String format)
    
Get a Java date from a string.
abstract java.lang.String getItemUrl(ItemScriptType item)
    
abstract boolean isEmpty(java.lang.String text)
    
Determine if the text has any non-whitespace value
abstract XmlScriptType newXmlDocument()
    
Creates a new XML document.
abstract XmlScriptType newXmlDocumentFromString(java.lang.String xmlString)
    
Creates a new XML document populated with the given XML string.
abstract int queryCount(java.lang.String[] collectionUuids, java.lang.String where)
    
Counts the number of items for the given collection definition and where clause.
abstract SearchResultsScriptType search(java.lang.String query, int offset, int maxResults)
    
Search for items.
abstract SearchResultsScriptType searchAdvanced(java.lang.String query, java.lang.String where, boolean onlyLive, int orderType, boolean reverseOrder, int offset, int maxResults)
    
Search for items with more advanced settings.
abstract void throwError(java.lang.String message)
    
Throws an exception.

 

Methods inherited from interface: com.tle.common.scripting.ScriptObject
scriptEnter, scriptExit

 

 

 

 

DEFAULT_VARIABLE

 

public static final java.lang.String DEFAULT_VARIABLE

 

See also: Constants

 

 

 

 

search

 

public abstract SearchResultsScriptType search( java.lang.String query,
int offset,
int maxResults)

 

Search for items.

 

Parameters:
query-
A freetext query
offset-
First result index
maxResults-
Number of results to get
Returns:
A SearchResultsScriptType object

 

 

 

searchAdvanced

 

public abstract SearchResultsScriptType searchAdvanced( java.lang.String query,
java.lang.String where,
boolean onlyLive,
int orderType,
boolean reverseOrder,
int offset,
int maxResults)

 

Search for items with more advanced settings.

 

Parameters:
query-
A freetext query
where-
An xpath/SQL like where clause. E.g.: /xml/mynode like 'something%'
onlyLive-
Return only items with a status of Live (e.g. not Draft)
orderType-
Can be one of: 0 - Ranking (search relevance), 1 - Date Modified, 2 - Name
reverseOrder-
Specify true to reverse the order specified in orderType
offset-
First result index
maxResults-
Number of results to get
Returns:
A SearchResultsScriptType object

 

 

 

queryCount

 

public abstract int queryCount( java.lang.String[] collectionUuids,
java.lang.String where)
throws java.lang.Exception

 

Counts the number of items for the given collection definition and where clause.

 

Parameters:
collectionUuids-
An array of collection definition UUIDs.
where-
A where clause. Can be blank. See searchAdvanced for the format of the where clause.
Returns:
The number of items that were counted.

 

 

 

facetCount

 

public abstract java.util.List<FacetCountResultScriptType> facetCount( java.lang.String query,
java.lang.String[] collectionUuids,
java.lang.String where,
java.lang.String facetXpath)

 

Retrieves a list of terms and item counts for an XPath.

 

Parameters:
query-
A freetext query
collectionUuids-
An array of collection definition UUIDs.
where-
An xpath/SQL like where clause. E.g.: /xml/mynode like 'something%'
facetXpath-
the XPath of the facet to return the terms and counts for.
Returns:
A list of FacetCountResultScriptType objects sorted by highest to lowest frequency.

 

 

 

getCollectionFromUuid

 

public abstract CollectionScriptType getCollectionFromUuid( java.lang.String collectionUuid)

 

Return a CollectionScriptType object based on the collectionUuid.

 

Parameters:
collectionUuid-
The UUID of the collection to locate
Returns:
A CollectionScriptType object or null if not found

 

 

 

getDate

 

public abstract java.util.Date getDate( java.lang.String date,
java.lang.String format)
throws java.text.ParseException

 

Get a Java date from a string.

 

Parameters:
date-
A date in string format
format-
The format of the date supplied
Returns:
A java.util.Date
Throws:
java.text.ParseException - If the format is invalid

 

 

 

isEmpty

 

public abstract boolean isEmpty( java.lang.String text)

 

Determine if the text has any non-whitespace value

 

Parameters:
text-
The value to check
Returns:
true if the value is null or an empty or all-whitespace string

 

 

 

getConnection

 

public abstract ConnectionScriptType getConnection( java.lang.String url)

 

Starts a connection with the site at URL.

 

Parameters:
url-
The URL to connect to
Returns:
A script object for retrieving data from the connection

 

 

 

throwError

 

public abstract void throwError( java.lang.String message)

 

Throws an exception. This will prevent any operation from completing normally, e.g. a wizard page submit, or an item save. You should only use this method in critical situations (e.g. an item cannot be saved)

 

Parameters:
message-
The error message

 

 

 

getItemUrl

 

public abstract java.lang.String getItemUrl( ItemScriptType item)

 

Parameters:
item-
An item to calculate the URL of
Returns:
A full URL to this item. E.g. http://myinstitution.edu.au/items/323a213e21fd31e2/1

 

 

 

newXmlDocument

 

public abstract XmlScriptType newXmlDocument( )

 

Creates a new XML document.

 

Returns:
A new XML document.

 

 

 

newXmlDocumentFromString

 

public abstract XmlScriptType newXmlDocumentFromString( java.lang.String xmlString)

 

Creates a new XML document populated with the given XML string.

 

Parameters:
xmlString-
XML string to populate the document with.
Returns:
A new XML document.