Class Dialog

All Implemented Interfaces:
Serializable, ListModel
Direct Known Subclasses:
PerspectiveDialog

public class Dialog extends AbstractListBean
A basic dialog implementation

Uses the freemarker library to interpolate the dialog's query with supplied arguments.
The provided query is processed such that all whitespace is replaced with a single space character.
Provides a couple of freemarker directives to query writers:

skip(value[, scope])
will skip (i.e. not output) the first occurance of the given value within the given scope
br
inserts an explicit newline

All arguments are wrapped in a freemarker object wrapper such that when referencing the argument's value the query writer uses argname.val and when referencing the argument's operator the query writer uses argname.op.

Aside from being a bean model for a dialog this class provides a ListModel interface on the dialog's arguments.

The interpolated query is defined as executable if all non-optional arguments have received valid values.

See Also:
  • Field Details

    • PROPERTY_TYPE

      public static final String PROPERTY_TYPE
      The property name for the dialog's type.
      See Also:
    • PROPERTY_BASE_QUERY

      public static final String PROPERTY_BASE_QUERY
      The property name for the dialog's base query (not interpolated).
      See Also:
    • PROPERTY_BASE_CHARTSCRIPT

      public static final String PROPERTY_BASE_CHARTSCRIPT
      The property name for the dialog's base query (not interpolated).
      See Also:
    • PROPERTY_BASE_CHARTEXEC

      public static final String PROPERTY_BASE_CHARTEXEC
      The property name for the dialog's base query (not interpolated).
      See Also:
    • PROPERTY_BASE_CHARTCOLUMNS

      public static final String PROPERTY_BASE_CHARTCOLUMNS
      The property name for the dialog's base query (not interpolated).
      See Also:
    • PROPERTY_BASE_CHARTDF

      public static final String PROPERTY_BASE_CHARTDF
      The property name for dialog's interpolated query (read only).
      See Also:
    • PROPERTY_QUERY

      public static final String PROPERTY_QUERY
      The property name for dialog's interpolated query (read only).
      See Also:
    • PROPERTY_CHART

      public static final String PROPERTY_CHART
      The property name for dialog's interpolated query (read only).
      See Also:
    • PROPERTY_EXECUTABLE

      public static final String PROPERTY_EXECUTABLE
      The property name for the dialog's executable state.
      See Also:
    • dialogDescription

      public final DialogDescription dialogDescription
    • errorMsgTemplate

      protected final String errorMsgTemplate
    • longRunningQueryTemplate

      protected final String longRunningQueryTemplate
    • version

      protected final String version
    • packageVersion

      protected final String packageVersion
    • gitSHA

      protected final String gitSHA
    • argumentMap

      protected final Map<String,Argument> argumentMap
    • attributes

      public Map<String,? extends Object> attributes
    • executable

      protected boolean executable
  • Constructor Details

  • Method Details

    • getFileResolver

      public org.gorpipe.gor.model.FileReader getFileResolver()
    • getQueryEval

      public org.gorpipe.gor.model.QueryEvaluator getQueryEval()
    • getName

      public String getName()
    • getShortName

      public String getShortName()
      Returns:
      The dialog name shortened so that it contains at most 2 capital letters (from right) and breaks on the right most underscore
    • getDescription

      public String getDescription()
    • getHelpLink

      public String getHelpLink()
    • getListDescription

      public String getListDescription()
    • getType

      public DialogType getType()
    • setType

      public void setType(DialogType type)
    • getBaseQuery

      public String getBaseQuery()
    • setBaseQuery

      public void setBaseQuery(String query) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getBaseChartExec

      public String getBaseChartExec()
    • setBaseChartExec

      public void setBaseChartExec(String chartExec) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getBaseChartScript

      public String getBaseChartScript()
    • setBaseChartScript

      public void setBaseChartScript(String chartScript)
    • getBaseChartDF

      public ChartDataType getBaseChartDF()
    • setBaseChartDF

      public void setBaseChartDF(ChartDataType chartDF)
    • getBaseChartColumns

      public String getBaseChartColumns()
    • setBaseChartColumns

      public void setBaseChartColumns(String chartColumns)
    • setDeferUpdates

      public void setDeferUpdates(boolean deferUpdates)
      Defer updates to interpolated query. If set - query won't be evaluated on every change to input parameters but only when requested through getInterpolatedQuery()
    • advancedArgumentsVisible

      public boolean advancedArgumentsVisible()
      Returns:
      true if advanced arguments are visible, otherwise false
    • setAdvancedArgumentsVisible

      public void setAdvancedArgumentsVisible(boolean visible)
      Parameters:
      visible - the visibility of advanced arguments to set
    • loadQuery

      protected void loadQuery(String queryName, String query)
    • interpolateQuery

      protected String interpolateQuery(String templateName) throws freemarker.template.TemplateException, IOException
      Throws:
      freemarker.template.TemplateException
      IOException
    • interpolateChart

      protected String interpolateChart(String templateName) throws freemarker.template.TemplateException, IOException
      Throws:
      freemarker.template.TemplateException
      IOException
    • calcInterpolatedQuery

      public void calcInterpolatedQuery() throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • getInterpolatedQuery

      public String getInterpolatedQuery()
    • getInterpolatedChart

      public String getInterpolatedChart()
    • getQuery

      public String getQuery()
    • getChart

      public String getChart()
    • getVersion

      public String getVersion()
    • getPackageVersion

      public String getPackageVersion()
    • getGitSha

      public String getGitSha()
    • getErrorMessage

      public String getErrorMessage()
    • determineLongRunningQuery

      public String determineLongRunningQuery()
    • copyArguments

      public List<Argument> copyArguments()
    • isExecutable

      public boolean isExecutable()
    • getArgument

      public Argument getArgument(String argumentName)
    • hasArgument

      public boolean hasArgument(String argumentName)
    • setArgument

      public void setArgument(String argumentName, Argument arg)
    • getAttribute

      public Object getAttribute(String attributeName)
    • getElementAt

      public Object getElementAt(int index)
    • getSize

      public int getSize()
    • toString

      public String toString()
      Overrides:
      toString in class Object