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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic enum -
Field Summary
FieldsModifier 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 Summary
ConstructorsConstructorDescriptionPublic empty ctor for xml serializationNamedQuery(NamedQuery nq) Copy constructor. -
Method Summary
Modifier 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_VERSION
public static final int LEGACY_RESOURCE_VERSIONOriginal resource version; a simple default 'data.bin' on disk- See Also:
-
CURRENT_RESOURCE_VERSION
public 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_TYPES
Suggested list of acceptable data types for named query parameters -
DATABASE_PARAM_IDENTIFIER
- See Also:
-
DATABASE_PARAM_OPTION
- See Also:
-
-
Constructor Details
-
NamedQuery
public NamedQuery()Public empty ctor for xml serialization -
NamedQuery
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
-
setType
-
getQuery
-
setQuery
-
getFallbackValue
-
setFallbackValue
-
isFallbackEnabled
public boolean isFallbackEnabled() -
setFallbackEnabled
public void setFallbackEnabled(boolean fallbackEnabled) -
getDatabase
-
setDatabase
-
getDescription
-
setDescription
-
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
-
setCacheUnit
-
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
-
setPermissions
-
getSyntaxProvider
-
setSyntaxProvider
-
getParameters
-
setParameters
-
getNamedTheme
Deprecated.Deprecated. Was used to persist a chosen code editor theme in the designer. -
setNamedTheme
Deprecated.Deprecated. Was used to persist a chosen code editor theme in the designer. -
isValidParamName
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
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
-