Class NamedQuery
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.db.namedquery.NamedQuery
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class NamedQuery extends java.lang.Object implements java.io.SerializableThis 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:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classNamedQuery.Parameterstatic classNamedQuery.ParameterTypestatic classNamedQuery.Type
 - 
Field SummaryFields Modifier and Type Field Description static intCURRENT_RESOURCE_VERSIONStored as a 'query.sql' file with the main query body, and all other aspects of the query as resource attributes.static java.lang.StringDATABASE_PARAM_IDENTIFIERstatic java.lang.StringDATABASE_PARAM_OPTIONstatic intLEGACY_RESOURCE_VERSIONOriginal resource version; a simple default 'data.bin' on diskstatic java.util.Set<DataType>PARAMETER_TYPESSuggested list of acceptable data types for named query parametersstatic ResourceTypeRESOURCE_TYPE
 - 
Constructor SummaryConstructors Constructor Description NamedQuery()Public empty ctor for xml serializationNamedQuery(NamedQuery nq)Copy constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static NamedQueryfromResource(ProjectResource resource, XMLDeserializer deserializer)Create a named query from a Project Resource - can be stored in legacy data.bin file, or modern query.sql + attributes;intgetCacheAmount()longgetCacheInMillis()TimeUnitsgetCacheUnit()java.lang.StringgetDatabase()java.lang.StringgetDescription()java.lang.StringgetFallbackValue()longgetMaxReturnSize()NamedThemegetNamedTheme()Deprecated.java.util.List<NamedQuery.Parameter>getParameters()java.util.List<ZoneRoleRequirement>getPermissions()java.lang.StringgetQuery()java.lang.StringgetSyntaxProvider()NamedQuery.TypegetType()booleanisAutoBatchEnabled()booleanisCachingEnabled()booleanisEnabled()booleanisFallbackEnabled()booleanisUseMaxReturnSize()static booleanisValidParamName(java.lang.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.voidsetAutoBatchEnabled(boolean autoBatchEnabled)voidsetCacheAmount(int cacheAmount)voidsetCacheUnit(TimeUnits cacheUnit)voidsetCachingEnabled(boolean cachingEnabled)voidsetDatabase(java.lang.String database)voidsetDescription(java.lang.String description)voidsetEnabled(boolean enabled)voidsetFallbackEnabled(boolean fallbackEnabled)voidsetFallbackValue(java.lang.String fallbackValue)voidsetMaxReturnSize(long maxReturnSize)voidsetNamedTheme(NamedTheme ignored)Deprecated.voidsetParameters(java.util.List<NamedQuery.Parameter> parameters)voidsetPermissions(java.util.List<ZoneRoleRequirement> permissions)voidsetQuery(java.lang.String query)voidsetSyntaxProvider(java.lang.String syntax)voidsetType(NamedQuery.Type type)voidsetUseMaxReturnSize(boolean useMaxReturnSize)static java.util.function.Consumer<ProjectResourceBuilder>toResource(NamedQuery nq)Provides a function to operate on a ProjectResourceBuilder in order to properly store a named query.
 
- 
- 
- 
Field Detail- 
RESOURCE_TYPEpublic static final ResourceType RESOURCE_TYPE 
 - 
LEGACY_RESOURCE_VERSIONpublic static final int LEGACY_RESOURCE_VERSION Original resource version; a simple default 'data.bin' on disk- See Also:
- Constant Field Values
 
 - 
CURRENT_RESOURCE_VERSIONpublic 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:
- Constant Field Values
 
 - 
PARAMETER_TYPESpublic static final java.util.Set<DataType> PARAMETER_TYPES Suggested list of acceptable data types for named query parameters
 - 
DATABASE_PARAM_IDENTIFIERpublic static final java.lang.String DATABASE_PARAM_IDENTIFIER - See Also:
- Constant Field Values
 
 - 
DATABASE_PARAM_OPTIONpublic static final java.lang.String DATABASE_PARAM_OPTION - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
NamedQuerypublic NamedQuery() Public empty ctor for xml serialization
 - 
NamedQuerypublic NamedQuery(@Nonnull NamedQuery nq)Copy constructor. Used by reports to override query limits and caching- Parameters:
- nq- Named Query to copy. Not null.
 
 
- 
 - 
Method Detail- 
getTypepublic NamedQuery.Type getType() 
 - 
setTypepublic void setType(NamedQuery.Type type) 
 - 
getQuerypublic java.lang.String getQuery() 
 - 
setQuerypublic void setQuery(java.lang.String query) 
 - 
getFallbackValue@Nullable public java.lang.String getFallbackValue() 
 - 
setFallbackValuepublic void setFallbackValue(java.lang.String fallbackValue) 
 - 
isFallbackEnabledpublic boolean isFallbackEnabled() 
 - 
setFallbackEnabledpublic void setFallbackEnabled(boolean fallbackEnabled) 
 - 
getDatabasepublic java.lang.String getDatabase() 
 - 
setDatabasepublic void setDatabase(java.lang.String database) 
 - 
getDescription@Nullable public java.lang.String getDescription() 
 - 
setDescriptionpublic void setDescription(java.lang.String description) 
 - 
isEnabledpublic boolean isEnabled() 
 - 
setEnabledpublic void setEnabled(boolean enabled) 
 - 
isCachingEnabledpublic boolean isCachingEnabled() 
 - 
setCachingEnabledpublic void setCachingEnabled(boolean cachingEnabled) 
 - 
getCacheAmountpublic int getCacheAmount() 
 - 
setCacheAmountpublic void setCacheAmount(int cacheAmount) 
 - 
getCacheUnitpublic TimeUnits getCacheUnit() 
 - 
setCacheUnitpublic void setCacheUnit(TimeUnits cacheUnit) 
 - 
getCacheInMillispublic long getCacheInMillis() 
 - 
isAutoBatchEnabledpublic boolean isAutoBatchEnabled() 
 - 
setAutoBatchEnabledpublic void setAutoBatchEnabled(boolean autoBatchEnabled) 
 - 
isUseMaxReturnSizepublic boolean isUseMaxReturnSize() 
 - 
setUseMaxReturnSizepublic void setUseMaxReturnSize(boolean useMaxReturnSize) 
 - 
getMaxReturnSizepublic long getMaxReturnSize() 
 - 
setMaxReturnSizepublic void setMaxReturnSize(long maxReturnSize) 
 - 
getPermissionspublic java.util.List<ZoneRoleRequirement> getPermissions() 
 - 
setPermissionspublic void setPermissions(java.util.List<ZoneRoleRequirement> permissions) 
 - 
getSyntaxProvider@Nullable public java.lang.String getSyntaxProvider() 
 - 
setSyntaxProviderpublic void setSyntaxProvider(java.lang.String syntax) 
 - 
getParameterspublic java.util.List<NamedQuery.Parameter> getParameters() 
 - 
setParameterspublic void setParameters(java.util.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.
 - 
isValidParamNamepublic static boolean isValidParamName(java.lang.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)
 
 - 
toResourcepublic static java.util.function.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 java.lang.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:
- java.lang.Exception
 
 
- 
 
-