Package se.conciliate.extensions.store
Interface MTList
- All Superinterfaces:
Comparable<MTNamedObject>
,MTHistoryEnabled
,MTListHeader
,MTNamedObject
- Author:
- Per-Erik
-
Nested Class Summary
Nested classes/interfaces inherited from interface se.conciliate.extensions.store.MTListHeader
MTListHeader.ResultType
-
Method Summary
Modifier and TypeMethodDescription<T> MTIterator<T>
Executes the script in this list and returns the result of the execution.Returns the type that this list will result in when executed.boolean
Returns true if the list is compilable.boolean
isStatic()
Returns true if the list is a "static" list that can be executed without having a symbol as its context.void
remove()
Removes this list.void
save()
Saves this list, either by updating its existing values or, if this is a completely new list, by persisting it as a new list.void
setColumns
(List<String> columns) Sets the columns that this list can generate.void
setLastModified
(Date lastModified) Overrides the last modified date of the list.void
Sets the script that this list is able to run.void
Sets the title in the current language.void
setTitle
(MTLanguageHeader language, String title) Sets the title in a given language.void
setUIGenerated
(boolean uiGenerated) Set the ui generated flag, indicating that a ui has constructed the script.void
Methods inherited from interface se.conciliate.extensions.store.MTHistoryEnabled
getHistory, getID, getUUID
Methods inherited from interface se.conciliate.extensions.store.MTListHeader
expand, getActionObject, getColumns, getLastModified, getScript, isUIGenerated
Methods inherited from interface se.conciliate.extensions.store.MTNamedObject
compareTo, getID, getParentRevisionID, getTitle, getTitle, getUUID
-
Method Details
-
isStatic
boolean isStatic()Returns true if the list is a "static" list that can be executed without having a symbol as its context.- Returns:
- true if the list is "static"
-
setUUID
-
setLastModified
Overrides the last modified date of the list.- Parameters:
lastModified
- The new last modified date.
-
setTitle
Sets the title in the current language. If this list is freshly created (not yet persisted) and this method has not been called before, it will callsetTitle(MTLanguageHeader, title)
for each MTLanguageHeader in the current context (repository/workspace). That is, this method ensures that the list has a title in all available languages.- Parameters:
title
- The new title.- Since:
- 3.0
-
setTitle
Sets the title in a given language.- Parameters:
language
- The language to set the title in.title
- The new title.- Since:
- 3.0
-
setScript
Sets the script that this list is able to run.- Parameters:
script
- The script- Since:
- 3.0
-
setColumns
Sets the columns that this list can generate.- Parameters:
columns
- A list of columns- Since:
- 3.0
-
setUIGenerated
void setUIGenerated(boolean uiGenerated) Set the ui generated flag, indicating that a ui has constructed the script.- Parameters:
uiGenerated
- the flag; true indicates ui generated.
-
getResultType
MTListHeader.ResultType getResultType()Returns the type that this list will result in when executed. This method might interpret the script but should generally be (by far) fast enough to be called on the event dispatch thread.- Returns:
- the type that this list will result in when executed.
-
isCompilable
boolean isCompilable()Returns true if the list is compilable. If the user has edited the script manually then this might not be true. -
save
Saves this list, either by updating its existing values or, if this is a completely new list, by persisting it as a new list.- Throws:
MTAccessException
- Since:
- 3.0
-
remove
Removes this list. This will permanently remove the list from storage.- Throws:
MTAccessException
- Since:
- 3.0
-
execute
Executes the script in this list and returns the result of the execution. Executing the script means that it translates the script to sql and then queries the database. This will thus be a background thread operation and should not be called from the event dispatch thread.- Type Parameters:
T
- The type parameter deduced from the parametertype
.- Parameters:
type
- Specifies the expected return value. If this lists script is associated with some other type, an illegal argument exception will be thrown. For example, callingexecute
on a list that listsMTModel
s with atype
ofMTSymbol
will result in an exception. If the type isLong.class
then the iterator will return the ID:s of the resulting entities.contextValues
- A varargs list containing the contextual values that this list might need to execute. This might be the id of the action object for symbol lists.- Returns:
- MTIterator An
MTIterator
- Throws:
Exception
- if an exception is raised by the script execution.IllegalArgumentException
- if the specifiedtype
is not what this lists script can generate or if the contextual values is not of the correct size. For symbol lists, the correct size is 1 if the list is dynamic (has an action object) and 0 if the action object is declared "STATIC".
-