Interface MTList

All Superinterfaces:
Comparable<MTNamedObject>, MTHistoryEnabled, MTListHeader, MTNamedObject

public interface MTList extends MTListHeader, MTHistoryEnabled
Author:
Per-Erik
  • 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

      void setUUID(String uuid)
    • setLastModified

      void setLastModified(Date lastModified)
      Overrides the last modified date of the list.
      Parameters:
      lastModified - The new last modified date.
    • setTitle

      void setTitle(String title)
      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 call setTitle(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

      void setTitle(MTLanguageHeader language, String title)
      Sets the title in a given language.
      Parameters:
      language - The language to set the title in.
      title - The new title.
      Since:
      3.0
    • setScript

      void setScript(String script)
      Sets the script that this list is able to run.
      Parameters:
      script - The script
      Since:
      3.0
    • setColumns

      void setColumns(List<String> columns)
      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

      void save() throws MTAccessException
      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

      void remove() throws MTAccessException
      Removes this list. This will permanently remove the list from storage.
      Throws:
      MTAccessException
      Since:
      3.0
    • execute

      <T> MTIterator<T> execute(Class<? extends T> type, String... contextValues) throws Exception
      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 parameter type.
      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, calling execute on a list that lists MTModels with a type of MTSymbol will result in an exception. If the type is Long.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 specified type 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".