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 int
MODE_EXPERT
static int
MODE_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 Deprecated Methods Modifier and Type Method Description void
connect(VisionClientContext appContext)
Calls connect() on all interaction descriptorsvoid
disconnect()
Calls disconnect() on all interaction descriptorsint
getAdapterMode()
BindingConfiguration
getBindingConfiguration()
java.lang.String
getDatasource()
QueryHolder
getDatasourceListener()
QueryHolder
getEffectiveUpdateQuery()
Returns the update queryQueryHolder
object.java.lang.String
getFallbackValue()
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()
QueryHolder
getPullQuery()
QueryHolder
getPushQuery()
Returns the update query.PropertyAdapter.PAType
getReferenceType()
java.lang.String[]
getSelectedCols()
java.lang.String
getTableName()
void
handleQueryReturnedError(java.lang.Exception error)
void
handleQueryReturnedNoRows()
void
handleQueryReturnedValue(java.lang.Object value)
Called by the query manager when the pull query has been run successfullyboolean
isPushEnabled()
void
notifyQueryRunning(boolean loading)
void
propertyChange(java.beans.PropertyChangeEvent evt)
protected java.lang.Object
registerQuery(int updateRate, boolean runOnce)
void
setAdapterMode(int i)
void
setDatasource(java.lang.String string)
void
setDatasourceListener(QueryHolder datasourceListener)
void
setFallbackValue(java.lang.String fallbackValue)
void
setKeyCols(java.lang.String[] strings)
void
setKeyVals(java.lang.String[] keyVals)
void
setOrderCols(java.lang.String[] orderCols)
void
setPullQuery(QueryHolder holder)
void
setPushConnected(boolean b)
void
setPushEnabled(boolean enabled)
void
setPushQuery(QueryHolder holder)
Deprecated.void
setPushQuery2(QueryHolder holder)
Assigns a new pushQuery to pushQuery2 and sets the legacy query to null.void
setSelectedCols(java.lang.String[] strings)
void
setTableName(java.lang.String string)
void
shutdown()
If pollingMode is POLLING_RELATIVE_RATE or POLLING_ABSOLUTE_RATE, then this disconnects the SQLPropertyAdapter from the QueryManager.void
startup()
Notifies the adapter that it is becoming active, and should start any polling/threaded activities.java.lang.String
toString()
protected void
updateTarget()
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
canUpdate, 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:Adapter
Retrieves an array of the interactions that this adapter depends on. An interaction descriptor describes an inter-component interaction.- Specified by:
getInteractions
in interfaceAdapter
-
getBindingConfiguration
public BindingConfiguration getBindingConfiguration()
- Specified by:
getBindingConfiguration
in interfaceSearchablePropertyAdapter
-
connect
public void connect(VisionClientContext appContext)
Description copied from class:AbstractPropertyAdapter
Calls connect() on all interaction descriptors- Specified by:
connect
in interfaceAdapter
- Overrides:
connect
in classAbstractPropertyAdapter
-
disconnect
public void disconnect()
Description copied from class:AbstractPropertyAdapter
Calls disconnect() on all interaction descriptors- Specified by:
disconnect
in interfaceAdapter
- Overrides:
disconnect
in classAbstractPropertyAdapter
-
startup
public void startup()
Description copied from interface:Adapter
Notifies the adapter that it is becoming active, and should start any polling/threaded activities.- Specified by:
startup
in interfaceAdapter
- Overrides:
startup
in 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:
shutdown
in interfaceAdapter
- Overrides:
shutdown
in classAbstractPropertyAdapter
-
registerQuery
protected java.lang.Object registerQuery(int updateRate, boolean runOnce)
- Specified by:
registerQuery
in classAbstractQueryAdapter
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
updateTarget
protected void updateTarget()
Description copied from class:AbstractPropertyAdapter
Sets 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:
updateTarget
in classAbstractPropertyAdapter
-
notifyQueryRunning
public void notifyQueryRunning(boolean loading)
- Specified by:
notifyQueryRunning
in interfaceIQueryResponseListener
-
handleQueryReturnedError
public void handleQueryReturnedError(java.lang.Exception error)
- Specified by:
handleQueryReturnedError
in interfaceIQueryResponseListener
-
handleQueryReturnedNoRows
public void handleQueryReturnedNoRows()
- Specified by:
handleQueryReturnedNoRows
in interfaceIQueryResponseListener
-
handleQueryReturnedValue
public void handleQueryReturnedValue(java.lang.Object value)
Called by the query manager when the pull query has been run successfully- Specified by:
handleQueryReturnedValue
in interfaceIQueryResponseListener
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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
@Deprecated public void setPushQuery(QueryHolder holder)
Deprecated.This is left for legacy reasons.- Parameters:
holder
- AQueryHolder
for the update query. Must not be null
-
setPushQuery2
public void setPushQuery2(QueryHolder holder)
Assigns a new pushQuery to pushQuery2 and sets the legacy query to null.- Parameters:
holder
- AQueryHolder
for the update query. Must not be null
-
getEffectiveUpdateQuery
public QueryHolder getEffectiveUpdateQuery()
Returns the update queryQueryHolder
object.- 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:
getReferenceType
in 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)
-
-