java.lang.Object
com.inductiveautomation.ignition.common.db.namedquery.NamedQuery
All Implemented Interfaces:
Serializable

public class NamedQuery extends Object implements Serializable
This class represents a single named query. Instances of this class are serialized using the default Ignition XML serialization and stored as project resources.
See Also:
  • Field Details

    • RESOURCE_TYPE

      public static final ResourceType RESOURCE_TYPE
    • LEGACY_RESOURCE_VERSION

      public static final int LEGACY_RESOURCE_VERSION
      Original resource version; a simple default 'data.bin' on disk
      See Also:
    • CURRENT_RESOURCE_VERSION

      public static final int CURRENT_RESOURCE_VERSION
      Stored as a 'query.sql' file with the main query body, and all other aspects of the query as resource attributes.
      See Also:
    • PARAMETER_TYPES

      public static final Set<DataType> PARAMETER_TYPES
      Suggested list of acceptable data types for named query parameters
    • DATABASE_PARAM_IDENTIFIER

      public static final String DATABASE_PARAM_IDENTIFIER
      See Also:
    • DATABASE_PARAM_OPTION

      public static final String DATABASE_PARAM_OPTION
      See Also:
  • Constructor Details

    • NamedQuery

      public NamedQuery()
      Public empty ctor for xml serialization
    • NamedQuery

      public NamedQuery(@Nonnull NamedQuery nq)
      Copy constructor. Used by reports to override query limits and caching
      Parameters:
      nq - Named Query to copy. Not null.
  • Method Details

    • isReadOnly

      public boolean isReadOnly()
    • setReadOnly

      public void setReadOnly(boolean isReadOnly)
    • getType

      public NamedQuery.Type getType()
    • setType

      public void setType(NamedQuery.Type type)
    • getQuery

      public String getQuery()
    • setQuery

      public void setQuery(String query)
    • getFallbackValue

      @Nullable public String getFallbackValue()
    • setFallbackValue

      public void setFallbackValue(String fallbackValue)
    • isFallbackEnabled

      public boolean isFallbackEnabled()
    • setFallbackEnabled

      public void setFallbackEnabled(boolean fallbackEnabled)
    • getDatabase

      public String getDatabase()
    • setDatabase

      public void setDatabase(String database)
    • getDescription

      @Nullable public String getDescription()
    • setDescription

      public void setDescription(String description)
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public void setEnabled(boolean enabled)
    • isCachingEnabled

      public boolean isCachingEnabled()
    • setCachingEnabled

      public void setCachingEnabled(boolean cachingEnabled)
    • getCacheAmount

      public int getCacheAmount()
    • setCacheAmount

      public void setCacheAmount(int cacheAmount)
    • getCacheUnit

      public TimeUnits getCacheUnit()
    • setCacheUnit

      public void setCacheUnit(TimeUnits cacheUnit)
    • getCacheInMillis

      public long getCacheInMillis()
    • isAutoBatchEnabled

      public boolean isAutoBatchEnabled()
    • setAutoBatchEnabled

      public void setAutoBatchEnabled(boolean autoBatchEnabled)
    • isUseMaxReturnSize

      public boolean isUseMaxReturnSize()
    • setUseMaxReturnSize

      public void setUseMaxReturnSize(boolean useMaxReturnSize)
    • getMaxReturnSize

      public long getMaxReturnSize()
    • setMaxReturnSize

      public void setMaxReturnSize(long maxReturnSize)
    • getPermissions

      public List<ZoneRoleRequirement> getPermissions()
    • setPermissions

      public void setPermissions(List<ZoneRoleRequirement> permissions)
    • getSyntaxProvider

      @Nullable public String getSyntaxProvider()
    • setSyntaxProvider

      public void setSyntaxProvider(String syntax)
    • getParameters

      public List<NamedQuery.Parameter> getParameters()
    • setParameters

      public void setParameters(List<NamedQuery.Parameter> parameters)
    • getNamedTheme

      @Deprecated(since="8.1.6") public NamedTheme getNamedTheme()
      Deprecated.
      Deprecated. Was used to persist a chosen code editor theme in the designer.
    • setNamedTheme

      @Deprecated(since="8.1.6") public void setNamedTheme(NamedTheme ignored)
      Deprecated.
      Deprecated. Was used to persist a chosen code editor theme in the designer.
    • isValidParamName

      public static boolean isValidParamName(String paramName)
      Checks to make sure a name is at least one character long and doesn't contain special characters Does not check for duplicates. See the isUniqueParamName method in ParameterTable.java
      Parameters:
      paramName - String parameter name to check. Do not include the key characters "{", ":", etc.
      Returns:
      true if the name is valid, false if the name is invalid (likely due to special characters)
    • toResource

      public static Consumer<ProjectResourceBuilder> toResource(@Nonnull NamedQuery nq)
      Provides a function to operate on a ProjectResourceBuilder in order to properly store a named query.
    • fromResource

      @Nonnull public static NamedQuery fromResource(ProjectResource resource, XMLDeserializer deserializer) throws Exception
      Create a named query from a Project Resource - can be stored in legacy data.bin file, or modern query.sql + attributes;
      Returns:
      The deserialized query, an empty default query, or an exception.
      Throws:
      Exception