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 class
static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Stored as a 'query.sql' file with the main query body, and all other aspects of the query as resource attributes.static final String
static final String
static final int
Original 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 NamedQuery
fromResource
(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;int
long
long
Deprecated.getQuery()
getType()
boolean
boolean
boolean
boolean
boolean
boolean
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.void
setAutoBatchEnabled
(boolean autoBatchEnabled) void
setCacheAmount
(int cacheAmount) void
setCacheUnit
(TimeUnits cacheUnit) void
setCachingEnabled
(boolean cachingEnabled) void
setDatabase
(String database) void
setDescription
(String description) void
setEnabled
(boolean enabled) void
setFallbackEnabled
(boolean fallbackEnabled) void
setFallbackValue
(String fallbackValue) void
setMaxReturnSize
(long maxReturnSize) void
setNamedTheme
(NamedTheme ignored) Deprecated.void
setParameters
(List<NamedQuery.Parameter> parameters) void
setPermissions
(List<ZoneRoleRequirement> permissions) void
void
setReadOnly
(boolean isReadOnly) void
setSyntaxProvider
(String syntax) void
setType
(NamedQuery.Type type) void
setUseMaxReturnSize
(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
-