Class RegionService
java.lang.Object
com.kosdev.kos.commons.core.service.region.RegionService
Provides access to region information.
Package changed in api version 9.
- Since:
- 1
- Version:
- 9
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDateFormat(DateFormat dateFormat) Adds a date format to the service.voidaddTimeFormat(TimeFormat timeFormat) Adds a time format to the service.voidaddUnitSystem(UnitSystem unitSystem) Adds a unit system to the service.Return the currently active region.Returns the built-in "factory" region.getMassUnit(String name) Return theUnitfor the specified name / alias that measures mass.getPressureUnit(String name) Return theUnitfor the specified name / alias that measures pressure.Returns the list of known regions.getTemperatureUnit(String name) Return theUnitfor the specified name / alias that measures temperature.Return theUnitfor the specified name / alias that is related to the specified measurement.getVolumeUnit(String name) Return theUnitfor the specified name / alias that measures volume.booleanReturn true if regions have been installed.voidsetActiveRegion(BaseRegion region) Set the currently active region.voidsetActiveRegion(String regionId) Set the currently active region.
-
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 createUnitSysteminstances for internal type conversion, as needed, as this is independent of display units.- Parameters:
unitSystem- the unit system to add- Since:
- 1
-
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.- Since:
- 1
-
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.- Since:
- 1
-
regionsInstalled
public boolean regionsInstalled()Return true if regions have been installed.- Since:
- 1
-
getRegions
Returns the list of known regions.- Since:
- 1
-
getActiveRegion
Return the currently active region.- Since:
- 1
-
setActiveRegion
Set the currently active region.- Parameters:
region- the region to make active- Since:
- 1
-
setActiveRegion
Set the currently active region.- Parameters:
regionId- id of the region to make active- Since:
- 1
-
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 used 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- Since:
- 1
-
getUnit
Return theUnitfor 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
- Since:
- 1
-
getTemperatureUnit
Return theUnitfor the specified name / alias that measures temperature.- Parameters:
name- the unit name / alias- Returns:
- matching unit or null
- Since:
- 1
-
getVolumeUnit
Return theUnitfor the specified name / alias that measures volume.- Parameters:
name- the unit name / alias- Returns:
- matching unit or null
- Since:
- 1
-
getMassUnit
Return theUnitfor the specified name / alias that measures mass.- Parameters:
name- the unit name / alias- Returns:
- matching unit or null
- Since:
- 1
-
getPressureUnit
Return theUnitfor the specified name / alias that measures pressure.- Parameters:
name- the unit name / alias- Returns:
- matching unit or null
- Since:
- 1
-