Class SQLPropertyAdapter
- java.lang.Object
-
- com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter
-
- com.inductiveautomation.factorypmi.application.binding.AbstractQueryAdapter
-
- com.inductiveautomation.factorypmi.application.binding.SQLPropertyAdapter
-
- All Implemented Interfaces:
Adapter,Adapter.ValueHolder,SearchablePropertyAdapter,PropertyAdapter,IQueryResponseListener,java.beans.PropertyChangeListener,java.util.EventListener
public class SQLPropertyAdapter extends AbstractQueryAdapter implements java.beans.PropertyChangeListener, IQueryResponseListener, SearchablePropertyAdapter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter
AbstractPropertyAdapter.EdtUpdateValue
-
Nested classes/interfaces inherited from interface com.inductiveautomation.factorypmi.application.binding.Adapter
Adapter.ValueHolder
-
Nested classes/interfaces inherited from interface com.inductiveautomation.factorypmi.application.binding.PropertyAdapter
PropertyAdapter.PAType
-
-
Field Summary
Fields Modifier and Type Field Description static intMODE_EXPERTstatic intMODE_SIMPLE-
Fields inherited from class com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter
appContext, isTargetPropertyDynamic, log, overlayOptOut, target, targetPropertyName, value, valueClass
-
-
Constructor Summary
Constructors Constructor Description SQLPropertyAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect(VisionClientContext appContext)Calls connect() on all interaction descriptorsvoiddisconnect()Calls disconnect() on all interaction descriptorsintgetAdapterMode()BindingConfigurationgetBindingConfiguration()java.lang.StringgetDatasource()QueryHoldergetDatasourceListener()QueryHoldergetEffectiveUpdateQuery()Returns the update queryQueryHolderobject.java.lang.StringgetFallbackValue()InteractionDescriptor[]getInteractions()Retrieves an array of the interactions that this adapter depends on.java.lang.String[]getKeyCols()java.lang.String[]getKeyVals()java.lang.String[]getOrderCols()QueryHoldergetPullQuery()QueryHoldergetPushQuery()Returns the update query.PropertyAdapter.PATypegetReferenceType()java.lang.String[]getSelectedCols()java.lang.StringgetTableName()voidhandleQueryReturnedError(java.lang.Exception error)voidhandleQueryReturnedNoRows()voidhandleQueryReturnedValue(java.lang.Object value)Called by the query manager when the pull query has been run successfullybooleanisPushEnabled()voidnotifyQueryRunning(boolean loading)voidpropertyChange(java.beans.PropertyChangeEvent evt)protected java.lang.ObjectregisterQuery(int updateRate, boolean runOnce)voidsetAdapterMode(int i)voidsetDatasource(java.lang.String string)voidsetDatasourceListener(QueryHolder datasourceListener)voidsetFallbackValue(java.lang.String fallbackValue)voidsetKeyCols(java.lang.String[] strings)voidsetKeyVals(java.lang.String[] keyVals)voidsetOrderCols(java.lang.String[] orderCols)voidsetPullQuery(QueryHolder holder)voidsetPushConnected(boolean b)voidsetPushEnabled(boolean enabled)voidsetPushQuery(QueryHolder holder)voidsetSelectedCols(java.lang.String[] strings)voidsetTableName(java.lang.String string)voidshutdown()If pollingMode is POLLING_RELATIVE_RATE or POLLING_ABSOLUTE_RATE, then this disconnects the SQLPropertyAdapter from the QueryManager.voidstartup()Notifies the adapter that it is becoming active, and should start any polling/threaded activities.java.lang.StringtoString()protected voidupdateTarget()Sets the target property to the value.-
Methods inherited from class com.inductiveautomation.factorypmi.application.binding.AbstractQueryAdapter
getPollingConfig, getPollingMode, getUpdateRate, isSerializableDataset, restartQuery, setPollingMode, setQValue, setSerializableDataset, setUpdateRate, shutdownQuery, startupQuery
-
Methods inherited from class com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter
getQValue, getTarget, getTargetDesc, getTargetFullPath, getTargetPropertyName, getValueClass, handleError, handleNullToPrimitive, initLogger, isDataUsed, isDataUsed, isOverlayOptOut, isTargetPropertyDynamic, isValid, isValueClassPrimitive, setOverlayOptOut, setSetterMethodName, setTarget, setTargetPropertyDynamic, setTargetPropertyName, setValue, setValueClass, updateQuality, updateValue, useQuality
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.factorypmi.application.binding.Adapter
getTarget, isValid, setTarget
-
Methods inherited from interface com.inductiveautomation.factorypmi.application.gateway.IQueryResponseListener
getTargetFullPath
-
Methods inherited from interface com.inductiveautomation.factorypmi.application.binding.PropertyAdapter
getTargetPropertyName, setTargetPropertyName
-
-
-
-
Field Detail
-
MODE_EXPERT
public static final int MODE_EXPERT
- See Also:
- Constant Field Values
-
MODE_SIMPLE
public static final int MODE_SIMPLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInteractions
public InteractionDescriptor[] getInteractions()
Description copied from interface:AdapterRetrieves an array of the interactions that this adapter depends on. An interaction descriptor describes an inter-component interaction.- Specified by:
getInteractionsin interfaceAdapter
-
getBindingConfiguration
public BindingConfiguration getBindingConfiguration()
- Specified by:
getBindingConfigurationin interfaceSearchablePropertyAdapter
-
connect
public void connect(VisionClientContext appContext)
Description copied from class:AbstractPropertyAdapterCalls connect() on all interaction descriptors- Specified by:
connectin interfaceAdapter- Overrides:
connectin classAbstractPropertyAdapter
-
disconnect
public void disconnect()
Description copied from class:AbstractPropertyAdapterCalls disconnect() on all interaction descriptors- Specified by:
disconnectin interfaceAdapter- Overrides:
disconnectin classAbstractPropertyAdapter
-
startup
public void startup()
Description copied from interface:AdapterNotifies the adapter that it is becoming active, and should start any polling/threaded activities.- Specified by:
startupin interfaceAdapter- Overrides:
startupin classAbstractPropertyAdapter
-
shutdown
public void shutdown()
If pollingMode is POLLING_RELATIVE_RATE or POLLING_ABSOLUTE_RATE, then this disconnects the SQLPropertyAdapter from the QueryManager. If pollingMode is POLLING_OFF, this is a noop.- Specified by:
shutdownin interfaceAdapter- Overrides:
shutdownin classAbstractPropertyAdapter
-
registerQuery
protected java.lang.Object registerQuery(int updateRate, boolean runOnce)- Specified by:
registerQueryin classAbstractQueryAdapter
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
updateTarget
protected void updateTarget()
Description copied from class:AbstractPropertyAdapterSets the target property to the value. If a problem occurs, the problem is displayed, not thrown. Note that updateValue() is probably a better bet, as it updates both value and quality.- Overrides:
updateTargetin classAbstractPropertyAdapter
-
notifyQueryRunning
public void notifyQueryRunning(boolean loading)
- Specified by:
notifyQueryRunningin interfaceIQueryResponseListener
-
handleQueryReturnedError
public void handleQueryReturnedError(java.lang.Exception error)
- Specified by:
handleQueryReturnedErrorin interfaceIQueryResponseListener
-
handleQueryReturnedNoRows
public void handleQueryReturnedNoRows()
- Specified by:
handleQueryReturnedNoRowsin interfaceIQueryResponseListener
-
handleQueryReturnedValue
public void handleQueryReturnedValue(java.lang.Object value)
Called by the query manager when the pull query has been run successfully- Specified by:
handleQueryReturnedValuein interfaceIQueryResponseListener
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractPropertyAdapter
-
getPullQuery
public QueryHolder getPullQuery()
-
setPullQuery
public void setPullQuery(QueryHolder holder)
-
getPushQuery
public QueryHolder getPushQuery()
Returns the update query. If the update query is a legacy query it returns that. If not the new query is returned.- Returns:
- The legacy update query if not null else the new version of update query.
-
setPushQuery
public void setPushQuery(QueryHolder holder)
-
getEffectiveUpdateQuery
public QueryHolder getEffectiveUpdateQuery()
Returns the update queryQueryHolderobject.- Returns:
- the QueryHolder for the update query or null if there is none.
-
setPushConnected
public void setPushConnected(boolean b)
-
isPushEnabled
public boolean isPushEnabled()
- Returns:
- whether or not the update query is enabled and whether pushing is currently allowed on this property.
-
setPushEnabled
public void setPushEnabled(boolean enabled)
-
getDatasource
public java.lang.String getDatasource()
-
setDatasource
public void setDatasource(java.lang.String string)
-
getAdapterMode
public int getAdapterMode()
-
getKeyCols
public java.lang.String[] getKeyCols()
-
getSelectedCols
public java.lang.String[] getSelectedCols()
-
getTableName
public java.lang.String getTableName()
-
setAdapterMode
public void setAdapterMode(int i)
-
setKeyCols
public void setKeyCols(java.lang.String[] strings)
-
setSelectedCols
public void setSelectedCols(java.lang.String[] strings)
-
setTableName
public void setTableName(java.lang.String string)
-
getFallbackValue
public java.lang.String getFallbackValue()
-
setFallbackValue
public void setFallbackValue(java.lang.String fallbackValue)
-
getReferenceType
public PropertyAdapter.PAType getReferenceType()
- Specified by:
getReferenceTypein interfacePropertyAdapter
-
getKeyVals
public java.lang.String[] getKeyVals()
-
setKeyVals
public void setKeyVals(java.lang.String[] keyVals)
-
getOrderCols
public java.lang.String[] getOrderCols()
-
setOrderCols
public void setOrderCols(java.lang.String[] orderCols)
-
getDatasourceListener
public QueryHolder getDatasourceListener()
-
setDatasourceListener
public void setDatasourceListener(QueryHolder datasourceListener)
-
-