Class PreferenceBasedAttributeRepository
java.lang.Object
com.e1c.g5.dt.internal.applications.PreferenceBasedAttributeRepository
- All Implemented Interfaces:
IApplicationAttributeRepository
public class PreferenceBasedAttributeRepository
extends Object
implements IApplicationAttributeRepository
The preference based
IApplicationAttributeRepository
implementation.
It stores the attributes in the ApplicationsPlugin
preference using the following structure:
- plugin root node - applicationTypes - applicationTypeId1 - applicationId1 - key1 = value1 - key2 = value2 - applicationId2 - key = value - applicationTypeId2 - ...
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(IApplication application, String key) Returns the attribute value by thekey
for the specifiedapplication
.void
setAttribute
(IApplication application, String key, String value) Sets the specified attribute for the givenapplication
.
-
Constructor Details
-
PreferenceBasedAttributeRepository
public PreferenceBasedAttributeRepository()
-
-
Method Details
-
setAttribute
public void setAttribute(IApplication application, String key, String value) throws ApplicationException Description copied from interface:IApplicationAttributeRepository
Sets the specified attribute for the givenapplication
.- Specified by:
setAttribute
in interfaceIApplicationAttributeRepository
- Parameters:
application
- the application to set the attribute, cannot benull
.key
- the string field that represents the key of the attribute, cannot benull
.value
- the string field that represents the value of the attribute, can benull
.- Throws:
ApplicationException
- if repostiory request failed
-
getAttribute
public Optional<String> getAttribute(IApplication application, String key) throws ApplicationException Description copied from interface:IApplicationAttributeRepository
Returns the attribute value by thekey
for the specifiedapplication
.- Specified by:
getAttribute
in interfaceIApplicationAttributeRepository
- Parameters:
application
- the application to obtain the attribute, cannot benull
.key
- the string field that represents the key of the attribute, cannot benull
.- Returns:
- the string field that represents the value of the attribute, never
null
. - Throws:
ApplicationException
- if repostiory request failed
-