Using the Encode/Decode Service
-
Add the com.sabre.edge.platform.optional.encodedecode dependency to your plug-in.
-
Obtain a reference to the IEncodeDecodeService service from the OSGI environment. If your Red App has an activator that inherits from AbstractEdgeBaseNonUIPlugin or AbstractEdgeBasePlugin, you only need the following line of code:
IEncodeDecodeService encodeDecodeService = Activator.getDefault().getServiceReference(IEncodeDecodeService.class);
-
Call either the encode or decode method, depending on what you want to achieve.
Pass the desired category and string to encode or decode. Both methods will return a list of string objects that represent matching entries.
List <String> result = encodeDecodeService.encode(Category.CITY_NAMES, "London");
List <String> result = encodeDecodeService.decode(Category.CITY_NAMES, "LON");
Sample Code
IEncodeDecodeService encodeDecodeService =
Activator.getDefault().getServiceReference(IEncodeDecodeService.class);
encodeDecodeService.encode(Category.CITY_NAMES, "London");
encodeDecodeService.decode(Category.CITY_NAMES, "LON");