Class NamedQuery
java.lang.Object
com.inductiveautomation.ignition.common.db.namedquery.NamedQuery
- All Implemented Interfaces:
- 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:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic enum
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intStored as a 'query.sql' file with the main query body, and all other aspects of the query as resource attributes.static final Stringstatic final Stringstatic final intOriginal resource version; a simple default 'data.bin' on diskSuggested list of acceptable data types for named query parametersstatic final ResourceType
- 
Constructor SummaryConstructorsConstructorDescriptionPublic empty ctor for xml serializationNamedQuery(NamedQuery nq) Copy constructor.
- 
Method SummaryModifier and TypeMethodDescriptionstatic 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;intlonglongDeprecated.getQuery()getType()booleanbooleanbooleanbooleanbooleanbooleanstatic booleanisValidParamName(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(String database) voidsetDescription(String description) voidsetEnabled(boolean enabled) voidsetFallbackEnabled(boolean fallbackEnabled) voidsetFallbackValue(String fallbackValue) voidsetMaxReturnSize(long maxReturnSize) voidsetNamedTheme(NamedTheme ignored) Deprecated.voidsetParameters(List<NamedQuery.Parameter> parameters) voidsetPermissions(List<ZoneRoleRequirement> permissions) voidvoidsetReadOnly(boolean isReadOnly) voidsetSyntaxProvider(String syntax) voidsetType(NamedQuery.Type type) voidsetUseMaxReturnSize(boolean useMaxReturnSize) static Consumer<ProjectResourceBuilder>toResource(NamedQuery nq) Provides a function to operate on a ProjectResourceBuilder in order to properly store a named query.
- 
Field Details- 
RESOURCE_TYPE
- 
LEGACY_RESOURCE_VERSIONpublic static final int LEGACY_RESOURCE_VERSIONOriginal resource version; a simple default 'data.bin' on disk- See Also:
 
- 
CURRENT_RESOURCE_VERSIONpublic static final int CURRENT_RESOURCE_VERSIONStored as a 'query.sql' file with the main query body, and all other aspects of the query as resource attributes.- See Also:
 
- 
PARAMETER_TYPESSuggested list of acceptable data types for named query parameters
- 
DATABASE_PARAM_IDENTIFIER- See Also:
 
- 
DATABASE_PARAM_OPTION- See Also:
 
 
- 
- 
Constructor Details- 
NamedQuerypublic NamedQuery()Public empty ctor for xml serialization
- 
NamedQueryCopy constructor. Used by reports to override query limits and caching- Parameters:
- nq- Named Query to copy. Not null.
 
 
- 
- 
Method Details- 
isReadOnlypublic boolean isReadOnly()
- 
setReadOnlypublic void setReadOnly(boolean isReadOnly) 
- 
getType
- 
setType
- 
getQuery
- 
setQuery
- 
getFallbackValue
- 
setFallbackValue
- 
isFallbackEnabledpublic boolean isFallbackEnabled()
- 
setFallbackEnabledpublic void setFallbackEnabled(boolean fallbackEnabled) 
- 
getDatabase
- 
setDatabase
- 
getDescription
- 
setDescription
- 
isEnabledpublic boolean isEnabled()
- 
setEnabledpublic void setEnabled(boolean enabled) 
- 
isCachingEnabledpublic boolean isCachingEnabled()
- 
setCachingEnabledpublic void setCachingEnabled(boolean cachingEnabled) 
- 
getCacheAmountpublic int getCacheAmount()
- 
setCacheAmountpublic void setCacheAmount(int cacheAmount) 
- 
getCacheUnit
- 
setCacheUnit
- 
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) 
- 
getPermissions
- 
setPermissions
- 
getSyntaxProvider
- 
setSyntaxProvider
- 
getParameters
- 
setParameters
- 
getNamedThemeDeprecated.Deprecated. Was used to persist a chosen code editor theme in the designer.
- 
setNamedThemeDeprecated.Deprecated. Was used to persist a chosen code editor theme in the designer.
- 
isValidParamNameChecks 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)
 
- 
toResourceProvides 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
 
 
-