Package com.tccc.kos.core.service.region
Class RegionService
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.AbstractService
com.tccc.kos.core.service.region.RegionService
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyListener
Provides access to region information.
- Since:
- 1.0
- Version:
- 2023-03-06
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDateFormat
(DateFormat dateFormat) Adds a date format to the service.void
addTimeFormat
(TimeFormat timeFormat) Adds a time format to the service.void
addUnitSystem
(UnitSystem unitSystem) Adds a unit system to the service.Return the currently active region.Returns the built-in "factory" region.getMassUnit
(String name) Return theUnit
for the specified name / alias that measures mass.getPressureUnit
(String name) Return theUnit
for the specified name / alias that measures pressure.Returns the list of known regions.getTemperatureUnit
(String name) Return theUnit
for the specified name / alias that measures temperature.Return theUnit
for the specified name / alias that is related to the specified measurement.getVolumeUnit
(String name) Return theUnit
for the specified name / alias that measures volume.void
setActiveRegion
(BaseRegion region) Set the currently active region.void
setActiveRegion
(String regionId) Set the currently active region.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
TOPIC_REGION
- See Also:
-
-
Method Details
-
addUnitSystem
Adds a unit system to the service. If the ID of the system is the same as an existing system, the existing system is replaced. These unit systems are exposed to external systems for unit conversion from standard kOS units (SI) to display units. Java code can createUnitSystem
instances for internal type conversion, as needed, as this is independent of display units.- Parameters:
unitSystem
- the unit system to add
-
addTimeFormat
Adds a time format to the service. If the ID of the format is the same as an existing format, the existing format is replaced. -
addDateFormat
Adds a date format to the service. If the ID of the format is the same as an existing format, the existing format is replaced. -
getRegions
Returns the list of known regions. -
getActiveRegion
Return the currently active region. -
setActiveRegion
Set the currently active region.- Parameters:
region
- the region to make active
-
setActiveRegion
Set the currently active region.- Parameters:
regionId
- id of the region to make active
-
getFactoryRegion
Returns the built-in "factory" region. This is a special region with an ID ofBaseRegion.FACTORY_ID
. This region is typically non-functional for normal operations, but is the default region using during factory installation.This simply calls
getRegions()
and returns the first region that returns true forisFactory()
, which by default is true when the ID of the region isRegion.FACTORY_ID
. If no factory region is found, then an exception is thrown.- Throws:
IllegalStateException
- if no factory region found
-
getUnit
Return theUnit
for the specified name / alias that is related to the specified measurement.- Parameters:
measure
- the type of measure to search for (null for any)name
- the unit name / alias- Returns:
- matching unit or null
-
getTemperatureUnit
Return theUnit
for the specified name / alias that measures temperature.- Parameters:
name
- the unit name / alias- Returns:
- matching unit or null
-
getVolumeUnit
Return theUnit
for the specified name / alias that measures volume.- Parameters:
name
- the unit name / alias- Returns:
- matching unit or null
-
getMassUnit
Return theUnit
for the specified name / alias that measures mass.- Parameters:
name
- the unit name / alias- Returns:
- matching unit or null
-
getPressureUnit
Return theUnit
for the specified name / alias that measures pressure.- Parameters:
name
- the unit name / alias- Returns:
- matching unit or null
-