Class LocationDatumDataSource
- All Implemented Interfaces:
DatumDataSource,DeviceInfoProvider,MultiDatumDataSource,net.solarnetwork.service.Identifiable,net.solarnetwork.settings.SettingSpecifierProvider
DatumDataSource that augments some other data source's datum values
with location IDs.
This is to be used to easily augment various datum that relate to a location
with the necessary DatumLocation.getLocationId() ID. This class also
implements the MultiDatumDataSource API, and will call the methods of
that API on the configured delegate if that also implements
MultiDatumDataSource. If the delegate does not implement
MultiDatumDataSource this class will "fake" that API by calling
DatumDataSource.readCurrentDatum() and returning that object in a
Collection.
- Since:
- 2.0
- Version:
- 1.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault value for thelocationIdPropertyNameproperty.static final StringDefault value for thesourceIdPropertyNameproperty.static final StringBundle name for price location lookup messages.Fields inherited from interface net.solarnetwork.node.service.DatumDataSource
EVENT_TOPIC_DATUM_CAPTUREDFields inherited from interface net.solarnetwork.service.Identifiable
GROUP_UID_PROPERTY, UID_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the datum class names to ignore.Get the class supported by this DataSource.Get the delegate.Get the location.Get theDatumLocationID to assign to datum.Get the JavaBean property name to set the foundDatumLocation.getLocationId()to on theNodeDatumreturned from the configureddelegate.Get the location ID and source ID as a single string value.net.solarnetwork.service.OptionalService<LocationService>Get theLocationServiceto use to lookupDatumLocationinstances via the configuredlocationIdproperty.Get the type of location to search for.Get the message bundle basename to use.org.springframework.context.MessageSourceGet the class supported by this DataSource.List<net.solarnetwork.settings.SettingSpecifier>Get the source ID.Get the JavaBean property name to set the foundDatumLocation.getSourceId()to on theNodeDatumreturned from the configureddelegate.getUid()booleanGet the "location service required" flag.Read the current value from the data source, returning as an unpersistedNodeDatumobject.Read multiple values from the data source, returning as a collection of unpersistedNodeDatumobjects.voidsetDatumClassNameIgnore(Set<String> datumClassNameIgnore) Set the datum class names to ignore.voidsetDelegate(DatumDataSource delegate) Set the delegate.voidsetLocationId(Long locationId) Set theDatumLocationID to assign to datum.voidsetLocationIdPropertyName(String locationIdPropertyName) Set the JavaBean property name to set the foundDatumLocation.getLocationId()to on theNodeDatumreturned from the configureddelegate.voidsetLocationKey(String key) Set the location ID and source ID as a single string value.voidsetLocationService(net.solarnetwork.service.OptionalService<LocationService> locationService) Set theLocationServiceto use to lookupDatumLocationinstances via the configuredlocationIdproperty.voidsetLocationType(String locationType) Set the type of location to search for.voidsetMessageBundleBasename(String messageBundleBaseName) Set the message bundle basename to use.voidsetMessageSource(org.springframework.context.MessageSource messageSource) Set the message source.voidsetRequireLocationService(boolean requireLocationService) Get the "location service required" flag.voidsetSourceId(String sourceId) Set the source ID.voidsetSourceIdPropertyName(String sourceIdPropertyName) Set the JavaBean property name to set the foundDatumLocation.getSourceId()to on theNodeDatumreturned from the configureddelegate.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.solarnetwork.node.service.DeviceInfoProvider
canPublishDeviceInfo, deviceInfo, deviceInfoSourceId
-
Field Details
-
DEFAULT_LOCATION_ID_PROP_NAME
Default value for thelocationIdPropertyNameproperty.- See Also:
-
DEFAULT_SOURCE_ID_PROP_NAME
Default value for thesourceIdPropertyNameproperty.- See Also:
-
PRICE_LOCATION_MESSAGE_BUNDLE
Bundle name for price location lookup messages.- See Also:
-
-
Constructor Details
-
LocationDatumDataSource
public LocationDatumDataSource()
-
-
Method Details
-
getDatumType
Description copied from interface:DatumDataSourceGet the class supported by this DataSource.- Specified by:
getDatumTypein interfaceDatumDataSource- Returns:
- class
-
getMultiDatumType
Description copied from interface:MultiDatumDataSourceGet the class supported by this DataSource.- Specified by:
getMultiDatumTypein interfaceMultiDatumDataSource- Returns:
- class
-
readMultipleDatum
Description copied from interface:MultiDatumDataSourceRead multiple values from the data source, returning as a collection of unpersistedNodeDatumobjects.- Specified by:
readMultipleDatumin interfaceMultiDatumDataSource- Returns:
- Datum
-
readCurrentDatum
Description copied from interface:DatumDataSourceRead the current value from the data source, returning as an unpersistedNodeDatumobject.- Specified by:
readCurrentDatumin interfaceDatumDataSource- Returns:
- Datum
-
toString
-
getUid
- Specified by:
getUidin interfacenet.solarnetwork.service.Identifiable
-
getGroupUid
- Specified by:
getGroupUidin interfacenet.solarnetwork.service.Identifiable
-
getSettingUid
- Specified by:
getSettingUidin interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
getDisplayName
- Specified by:
getDisplayNamein interfacenet.solarnetwork.service.Identifiable- Specified by:
getDisplayNamein interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()- Specified by:
getMessageSourcein interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource) Set the message source.- Parameters:
messageSource- the message source to set
-
getSettingSpecifiers
- Specified by:
getSettingSpecifiersin interfacenet.solarnetwork.settings.SettingSpecifierProvider
-
getDelegate
Get the delegate.- Returns:
- the delegate
-
setDelegate
Set the delegate.- Parameters:
delegate- the delegate to set
-
getLocationService
Get theLocationServiceto use to lookupDatumLocationinstances via the configuredlocationIdproperty.- Returns:
- the location service
-
setLocationService
public void setLocationService(net.solarnetwork.service.OptionalService<LocationService> locationService) Set theLocationServiceto use to lookupDatumLocationinstances via the configuredlocationIdproperty.- Parameters:
locationService- the service to use
-
getLocationIdPropertyName
Get the JavaBean property name to set the foundDatumLocation.getLocationId()to on theNodeDatumreturned from the configureddelegate.- Returns:
- the location ID property name; defaults to
DEFAULT_LOCATION_ID_PROP_NAME
-
setLocationIdPropertyName
Set the JavaBean property name to set the foundDatumLocation.getLocationId()to on theNodeDatumreturned from the configureddelegate.The object must support a JavaBean setter method for this property.
- Parameters:
locationIdPropertyName- the property name to use
-
isRequireLocationService
public boolean isRequireLocationService()Get the "location service required" flag.- Returns:
- the location service reqiured flag; defaults to false
-
setRequireLocationService
public void setRequireLocationService(boolean requireLocationService) Get the "location service required" flag.If configured as true then return null data only instead of calling the
delegate. This is designed for services that require a location ID to be set, for example a Location Datum logger.- Parameters:
requireLocationService- the required setting to use
-
getLocationType
Get the type of location to search for.- Returns:
- the type; defaults to
PriceLocation
-
setLocationType
Set the type of location to search for.- Parameters:
locationType- the location type
-
getMessageBundleBasename
Get the message bundle basename to use.- Returns:
- the basename; defaults to
PRICE_LOCATION_MESSAGE_BUNDLE
-
setMessageBundleBasename
Set the message bundle basename to use.This can be customized so different messages can be shown for different uses of this proxy.
- Parameters:
messageBundleBaseName- the basename to use
-
getLocationKey
Get the location ID and source ID as a single string value. The format of the key islocationId:sourceId.- Returns:
- the location key, or null if both the location ID and source ID values are null
-
setLocationKey
Set the location ID and source ID as a single string value. The format of the key islocationId:sourceId.- Parameters:
key- the location and source ID key
-
getLocationId
Get theDatumLocationID to assign to datum.- Returns:
- the location ID
-
setLocationId
Set theDatumLocationID to assign to datum.- Parameters:
locationId- the location ID
-
getLocation
Get the location.- Returns:
- the location
-
getDatumClassNameIgnore
Get the datum class names to ignore.- Returns:
- the ignore set
-
setDatumClassNameIgnore
Set the datum class names to ignore.- Parameters:
datumClassNameIgnore- the ignore set
-
getSourceId
Get the source ID.- Returns:
- the source ID
-
setSourceId
Set the source ID.- Parameters:
sourceId- the source ID to use
-
getSourceIdPropertyName
Get the JavaBean property name to set the foundDatumLocation.getSourceId()to on theNodeDatumreturned from the configureddelegate.- Returns:
- the source ID property name; defaults to
DEFAULT_SOURCE_ID_PROP_NAME
-
setSourceIdPropertyName
Set the JavaBean property name to set the foundDatumLocation.getSourceId()to on theNodeDatumreturned from the configureddelegate.The object must support a JavaBean setter method for this property.
- Parameters:
sourceIdPropertyName- the source ID property name to use
-