Class QualityCode
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.model.values.QualityCode
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public final class QualityCode extends java.lang.Object implements java.io.SerializableQualityCode contains a 32-bit integer code and optionally a diagnostic string.The 32-bits are arranged as follows: First two bits represent the level 0b00 GOOD 0b01 UNCERTAIN 0b10 BAD 0b11 RESERVED The next 14 bits are reserved, and NOT CURRENTLY USED. The lower 16 bits represent the meaning of the code. Inductive Automation reserves the first 1024 codes(0x0000 through 0x03FF) for codes that it will define. By convention, our codes are broken up into four bands within the range of 0 through 1023. - Values 0-255 are "good" codes.
- Values 256-511 are "uncertain" codes
- Values 512 - 767 are "bad" codes that represent a condition that should have been expected (something didn't work in a way that was entirely predictable, like a device was not connected)
- Values 768 - 1023 are "worse" bad quality and represent an unambiguous error state - something must be changed.
 Third parties may use codes 1024 through 65535 (0x0400 through 0xFFFF) for their own codes, although doing so will tend to cause very generic "good / bad" representations of the quality. The (optional) diagnosticMessage field in this class is used to add contextual information about the circumstance in which the quality code was generated. It is NOT meant to be the name or description of the quality code. In many cases, only the code will be stored / transferred for efficiency, and the diagnostic message may be lost in the long term (e.g. if the code is stored as part of tag history) - See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classQualityCode.Level
 - 
Field SummaryFields Modifier and Type Field Description static QualityCodeBadGeneral quality for a bad value.static QualityCodeBad_AccessDeniedData requested requires credentials not held by requesting user.static QualityCodeBad_AggregateNotFoundRequested aggregate was not found.static QualityCodeBad_DatabaseNotConnectedA database connection required for this value is not connected.static QualityCodeBad_DisabledData source is not currently enabled.static QualityCodeBad_FailureA "failure" code was received from the underlying system.static QualityCodeBad_GatewayCommOffConnection to the Ignition gateway is currently turned off.static QualityCodeBad_LicenseExceededA license limit has been exceeded.static QualityCodeBad_NotConnectedA connection required for this value is not currently connected.static QualityCodeBad_NotFoundObject requested was not found.static QualityCodeBad_OutOfRangeThis value has exceeded its allowed range.static QualityCodeBad_ReadOnlyA write was attempted on a read only target.static QualityCodeBad_ReferenceNotFoundDerived or referenced value required an object which was not found.static QualityCodeBad_StaleData is out-of-date based upon the requested refresh interval.static QualityCodeBad_TrialExpiredThe trial mode's timer has expired.static QualityCodeBad_UnauthorizedAn unauthorized request was made for data that requires authorization.static QualityCodeBad_UnsupportedThe operation is not supported by the target.static QualityCodeErrorAn unexpected error occurred while retrieving or calculating this value.static QualityCodeError_ConfigurationThe source of this value is not configured correctly.static QualityCodeError_CycleDetectedCalculating the value involved an execution cycle.static QualityCodeError_DatabaseQueryA database query required for this value caused an error upon execution.static QualityCodeError_ExceptionAn exception was caught, and logged in the relevant system.static QualityCodeError_ExpressionEvalThe source expression was unable to be executed.static QualityCodeError_FormattingAttempted formatting (numeric, date formatting) failed.static QualityCodeError_InvalidPathSyntaxA path (tag path, property path, etc) was not able to be parsed because the syntax is invalid.static QualityCodeError_IOAn input/output error occurred while attempting to retrieve or calculate this value.static QualityCodeError_ScriptEvalA script needed to create this value failed to execute.static QualityCodeError_TagExecutionThe source tag could not be executed.static QualityCodeError_TimeoutExpiredAn asynchronous operation failed due to a timeout.static QualityCodeError_TypeConversionThe actual value was not able to be coerced into the configured data type for the source of this value.static QualityCodeGoodThis is the standard good value in the Ignition code base, but continues to use the legacy 192 user code.static QualityCodeGood_BackfillUsed to indicate good quality values that have arrived out of order.static QualityCodeGood_InitialSpecial flag simply indicates that this is an initial/seed value for a system just starting up.static QualityCodeGood_OverloadGood data that is being sampled slower than requested due to resource limitations.static QualityCodeGood_ProvisionalGood data that should not be considered valid long-term.static QualityCodeGood_UnspecifiedGeneral quality for good data.static QualityCodeGood_WritePendingSpecial value used when an underlying data source is being written to.static QualityCodeUncertainAn unspecified degree of uncertainty exists in this value.static QualityCodeUncertain_DataSubNormalInsufficient good-quality sources required for the derivation of this value.static QualityCodeUncertain_EngineeringUnitsExceededUsed to indicate that a value has gone beyond its configured engineering units.static QualityCodeUncertain_IncompleteOperationAn asynchronous operation is currently pending and its result is unknown.static QualityCodeUncertain_InitialValueUsed to indicate that a subscription has been made and a good value should be arriving shortly.static QualityCodeUncertain_LastKnownValueThe current value is unavailable, this represents the last known good value.
 - 
Constructor SummaryConstructors Constructor Description QualityCode(int code)QualityCode(int code, java.lang.String diagnosticMessage)QualityCode(QualityCode copy)QualityCode(QualityCode.Level level, int userCode)QualityCode(QualityCode.Level level, int userCode, java.lang.String diagnosticMessage)QualityCode(QualityCode copy, java.lang.String diagnosticMessage)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QualityCodederive(java.lang.String diagnosticMessage)Returns a QualityCode with the same underlying code, but the specifieddiagnosticMessage.booleanequals(java.lang.Object obj)intgetCode()static java.lang.StringgetCodeName(int code)static java.lang.StringgetCodeName(QualityCode code)static com.inductiveautomation.ignition.common.gson.JsonObjectgetCodesJson()java.lang.StringgetDiagnosticMessage()QualityCode.LevelgetLevel()static QualityCode.LevelgetLevel(int code)static QualityCode.LevelgetLevel(QualityCode code)java.lang.StringgetName()static QualityCodegetQualityFor(int code)static QualityCodegetQualityFor(java.lang.String name)static QualityCodegetQualityFromUserCode(int code)booleanis(QualityCode other)Helper function that compares the integer code of the given quality to this one.booleanisBad()booleanisBadOrError()booleanisError()booleanisGood()booleanisNot(QualityCode other)Helper function that compares the integer code of the given quality to this one.booleanisNotGood()booleanisUncertain()java.lang.StringtoString()QualifiedValuetoValue()Returns this quality as the quality component of a qualified value.static QualityCode[]values()static QualityCodeworstOf(QualityCode a, QualityCode b)static QualityCodeworstOfAll(QualityCode... q)
 
- 
- 
- 
Field Detail- 
Good_Unspecifiedpublic static final QualityCode Good_Unspecified General quality for good data.
 - 
Good_WritePendingpublic static final QualityCode Good_WritePending Special value used when an underlying data source is being written to.
 - 
Goodpublic static final QualityCode Good This is the standard good value in the Ignition code base, but continues to use the legacy 192 user code. The Good_Unspecified quality code with subcode 0 would be the "modern" base good value.
 - 
Good_Provisionalpublic static final QualityCode Good_Provisional Good data that should not be considered valid long-term. Do not cache. We make it a bigger user code than "Good" so that worstOf considers it worse...
 - 
Good_Initialpublic static final QualityCode Good_Initial Special flag simply indicates that this is an initial/seed value for a system just starting up.
 - 
Good_Overloadpublic static final QualityCode Good_Overload Good data that is being sampled slower than requested due to resource limitations.
 - 
Good_Backfillpublic static final QualityCode Good_Backfill Used to indicate good quality values that have arrived out of order. Different systems can choose to process them accordingly.
 - 
Uncertainpublic static final QualityCode Uncertain An unspecified degree of uncertainty exists in this value. Good luck!
 - 
Uncertain_LastKnownValuepublic static final QualityCode Uncertain_LastKnownValue The current value is unavailable, this represents the last known good value.
 - 
Uncertain_InitialValuepublic static final QualityCode Uncertain_InitialValue Used to indicate that a subscription has been made and a good value should be arriving shortly.
 - 
Uncertain_DataSubNormalpublic static final QualityCode Uncertain_DataSubNormal Insufficient good-quality sources required for the derivation of this value.
 - 
Uncertain_EngineeringUnitsExceededpublic static final QualityCode Uncertain_EngineeringUnitsExceeded Used to indicate that a value has gone beyond its configured engineering units.
 - 
Uncertain_IncompleteOperationpublic static final QualityCode Uncertain_IncompleteOperation An asynchronous operation is currently pending and its result is unknown.
 - 
Badpublic static final QualityCode Bad General quality for a bad value.
 - 
Bad_Unauthorizedpublic static final QualityCode Bad_Unauthorized An unauthorized request was made for data that requires authorization.
 - 
Bad_AccessDeniedpublic static final QualityCode Bad_AccessDenied Data requested requires credentials not held by requesting user.
 - 
Bad_Disabledpublic static final QualityCode Bad_Disabled Data source is not currently enabled.
 - 
Bad_Stalepublic static final QualityCode Bad_Stale Data is out-of-date based upon the requested refresh interval.
 - 
Bad_TrialExpiredpublic static final QualityCode Bad_TrialExpired The trial mode's timer has expired.
 - 
Bad_LicenseExceededpublic static final QualityCode Bad_LicenseExceeded A license limit has been exceeded.
 - 
Bad_NotFoundpublic static final QualityCode Bad_NotFound Object requested was not found.
 - 
Bad_ReferenceNotFoundpublic static final QualityCode Bad_ReferenceNotFound Derived or referenced value required an object which was not found.
 - 
Bad_AggregateNotFoundpublic static final QualityCode Bad_AggregateNotFound Requested aggregate was not found.
 - 
Bad_NotConnectedpublic static final QualityCode Bad_NotConnected A connection required for this value is not currently connected.
 - 
Bad_GatewayCommOffpublic static final QualityCode Bad_GatewayCommOff Connection to the Ignition gateway is currently turned off.
 - 
Bad_OutOfRangepublic static final QualityCode Bad_OutOfRange This value has exceeded its allowed range.
 - 
Bad_DatabaseNotConnectedpublic static final QualityCode Bad_DatabaseNotConnected A database connection required for this value is not connected.
 - 
Bad_ReadOnlypublic static final QualityCode Bad_ReadOnly A write was attempted on a read only target.
 - 
Bad_Failurepublic static final QualityCode Bad_Failure A "failure" code was received from the underlying system. Additional details may be in the diagnostic message. This generally doesn't not indicate an exception, which would be handled by Error_Exception, but instead a simple failure from a system that can return success or failure.
 - 
Bad_Unsupportedpublic static final QualityCode Bad_Unsupported The operation is not supported by the target.
 - 
Errorpublic static final QualityCode Error An unexpected error occurred while retrieving or calculating this value.
 - 
Error_Configurationpublic static final QualityCode Error_Configuration The source of this value is not configured correctly.
 - 
Error_ExpressionEvalpublic static final QualityCode Error_ExpressionEval The source expression was unable to be executed.
 - 
Error_TagExecutionpublic static final QualityCode Error_TagExecution The source tag could not be executed.
 - 
Error_TypeConversionpublic static final QualityCode Error_TypeConversion The actual value was not able to be coerced into the configured data type for the source of this value.
 - 
Error_DatabaseQuerypublic static final QualityCode Error_DatabaseQuery A database query required for this value caused an error upon execution.
 - 
Error_IOpublic static final QualityCode Error_IO An input/output error occurred while attempting to retrieve or calculate this value.
 - 
Error_TimeoutExpiredpublic static final QualityCode Error_TimeoutExpired An asynchronous operation failed due to a timeout.
 - 
Error_Exceptionpublic static final QualityCode Error_Exception An exception was caught, and logged in the relevant system.
 - 
Error_InvalidPathSyntaxpublic static final QualityCode Error_InvalidPathSyntax A path (tag path, property path, etc) was not able to be parsed because the syntax is invalid.
 - 
Error_Formattingpublic static final QualityCode Error_Formatting Attempted formatting (numeric, date formatting) failed.
 - 
Error_ScriptEvalpublic static final QualityCode Error_ScriptEval A script needed to create this value failed to execute.
 - 
Error_CycleDetectedpublic static final QualityCode Error_CycleDetected Calculating the value involved an execution cycle.
 
- 
 - 
Constructor Detail- 
QualityCodepublic QualityCode(QualityCode.Level level, int userCode) 
 - 
QualityCodepublic QualityCode(QualityCode.Level level, int userCode, java.lang.String diagnosticMessage) 
 - 
QualityCodepublic QualityCode(QualityCode copy) 
 - 
QualityCodepublic QualityCode(QualityCode copy, java.lang.String diagnosticMessage) 
 - 
QualityCodepublic QualityCode(int code) 
 - 
QualityCodepublic QualityCode(int code, java.lang.String diagnosticMessage)
 
- 
 - 
Method Detail- 
getCodepublic int getCode() 
 - 
getDiagnosticMessage@Nullable public java.lang.String getDiagnosticMessage() - Returns:
- the diagnostic message associated with this quality, if present. Otherwise, null.
 
 - 
isGoodpublic boolean isGood() - Returns:
- true if this code represents a good quality
 
 - 
isUncertainpublic boolean isUncertain() - Returns:
- true if this code is uncertain level (but _not_ bad or error)
 
 - 
isBadpublic boolean isBad() - Returns:
- true if this code is bad level (but _not_ error or uncertain)
 
 - 
isErrorpublic boolean isError() - Returns:
- true if this code is error level (but _not_ bad or uncertain)
 
 - 
isNotGoodpublic boolean isNotGood() - Returns:
- true if this code is uncertain, bad, or error
 
 - 
isBadOrErrorpublic boolean isBadOrError() - Returns:
- true if this code is bad or error
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getLevelpublic QualityCode.Level getLevel() 
 - 
getLevelpublic static QualityCode.Level getLevel(int code) 
 - 
getLevelpublic static QualityCode.Level getLevel(QualityCode code) 
 - 
getCodeNamepublic static java.lang.String getCodeName(int code) - Returns:
- the name of the given code, if known. Otherwise, returns the code's severity and its numeric value.
 
 - 
getCodeNamepublic static java.lang.String getCodeName(QualityCode code) - Returns:
- the name of the given code, if known. Otherwise, returns the code's severity and its numeric value.
 
 - 
getCodesJsonpublic static com.inductiveautomation.ignition.common.gson.JsonObject getCodesJson() - Returns:
- a JSON object whose keys are code numbers and whose values are the code names
 
 - 
worstOfpublic static QualityCode worstOf(QualityCode a, QualityCode b) 
 - 
worstOfAllpublic static QualityCode worstOfAll(QualityCode... q) 
 - 
derivepublic QualityCode derive(java.lang.String diagnosticMessage) Returns a QualityCode with the same underlying code, but the specifieddiagnosticMessage.- Parameters:
- diagnosticMessage- the diagnostic message.
- Returns:
- a QualityCode with the same underlying code, but the specified diagnosticMessage.
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
ispublic boolean is(QualityCode other) Helper function that compares the integer code of the given quality to this one.
 - 
isNotpublic boolean isNot(QualityCode other) Helper function that compares the integer code of the given quality to this one.
 - 
getNamepublic java.lang.String getName() - Returns:
- the name of the given code, if known. Otherwise, returns the code's severity and its numeric value.
 
 - 
getQualityForpublic static QualityCode getQualityFor(java.lang.String name) 
 - 
getQualityFromUserCodepublic static QualityCode getQualityFromUserCode(int code) 
 - 
getQualityForpublic static QualityCode getQualityFor(int code) 
 - 
valuespublic static QualityCode[] values() 
 - 
toValuepublic QualifiedValue toValue() Returns this quality as the quality component of a qualified value.
 
- 
 
-