Class TroubleInfoFactory
java.lang.Object
com.tccc.kos.commons.core.service.trouble.TroubleInfoFactory
Simple implementation of
TroubleInfoFactory that loads an array
of TroubleInfo objects from a json stream.
The will match the trouble using the simple name of the trouble class.
For any case where no info is found, an entry with a name of
default will be used instead.
The file format is as follows:
{
"PrimeTrouble" : {
visibleRole: "CREW",
actionRole: "TECHNICIAN",
rank: 100,
color: "orange"
},
...
"default" : {
visibleRole: "CREW",
rank: 100,
color: "white"
}
}
The properties are intended to be used as follows:
- visibleRole : The minimum role that can view the trouble. In some cases troubles are intended for technicians and shouldn't be shown to other users.
- actionRole : The minimum role that can resolve the trouble. In some cases a trouble may be shown to users but only technician can resolve it. If not specified, actionRole is assumed to be the same as visibleRole.
- rank : The sort order of the trouble. Used when the highest priority trouble must be shown to a user.
- color : The color hint for the trouble.
The values stored in the structure are not defined and can be adjusted to match the needs of the ui. For example, color may be specified as a color code or css name. The names of the objects are the types of the troubles (the simple class name of the trouble class).
- Since:
- 1.0
- Version:
- 2023-01-31
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTroubleInfo(Trouble trouble) booleanload(Object key, InputStream is, Class<? extends TroubleInfo> clazz) Load the specified info file.voidUnload the trouble info associated with the specified key.
-
Constructor Details
-
TroubleInfoFactory
public TroubleInfoFactory()
-
-
Method Details
-
load
Load the specified info file.- Parameters:
key- the key for the info data, used for removeis- input stream containing the infoclazz- theTroubleInfosubclass to use
-
unload
Unload the trouble info associated with the specified key.- Parameters:
key- the key used to load the info
-
getTroubleInfo
-