Package org.openwms.core.preferences
Interface PreferencesService
- All Known Implementing Classes:
PreferencesServiceImpl
public interface PreferencesService
A PreferencesService is responsible to manage
Preferences. Whereby Preferences have particular defined scopes, e.g. some
are defined in global scope which means they are visible and valid for the whole application. Others are only valid in a certain
restricted scope, probably only visible for a particular Module, Role or User.- Author:
- Heiko Scherrer
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NotNull PreferenceEOcreate(@NotNull PreferenceEO preference) Create a new non-existingPreference.voidDelete an existingPreference.booleanexistsForOwnerAndScopeAndKey(String owner, @NotNull PropertyScope scope, @NotBlank String key) Checks whether aPreferenceof a specificscopethat belongs to the givenownerand has the givenkeyexists.@NotNull Collection<PreferenceEO> findAll()Find and return allPreferences.@NotNull PreferenceEOfindByPKey(@NotBlank String pKey) Find and return thePreferencesidentified by thepKey.@NotNull Collection<PreferenceEO> findForOwnerAndScope(String owner, @NotNull PropertyScope scope) Find and return allPreferencesof a specificscopethat belong to the givenowner.findForOwnerAndScopeAndKey(String owner, @NotNull PropertyScope scope, @NotBlank String key) Find and return thePreferenceof a specificscopethat belongs to the givenownerand has the givenkey.findForScopeOwnerGroupName(String owner, @NotNull PropertyScope scope, @NotBlank String groupName) Find and return allPreferences that belong to a group with the samegroupName.voidLoadPreferencesfrom file and merge them with the ones in the persistent store.@NotNull PreferenceEOupdate(@NotBlank String pKey, @NotNull PreferenceEO preference) Update the given and existingPreference.
-
Method Details
-
findAll
Find and return allPreferences.- Returns:
- A Collection of Preferences, never null
-
findByPKey
Find and return thePreferencesidentified by thepKey.- Parameters:
pKey- The persistent identifier- Returns:
- The instance, never null
- Throws:
org.ameba.exception.NotFoundException- If the instance does not exist
-
findForOwnerAndScope
@NotNull @NotNull Collection<PreferenceEO> findForOwnerAndScope(String owner, @NotNull @NotNull PropertyScope scope) Find and return allPreferencesof a specificscopethat belong to the givenowner.- Parameters:
owner- The owner of the Preferencescope- What kind of Preference it is- Returns:
- A Collection of Preferences, never null
-
findForOwnerAndScopeAndKey
Optional<PreferenceEO> findForOwnerAndScopeAndKey(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String key) Find and return thePreferenceof a specificscopethat belongs to the givenownerand has the givenkey.- Parameters:
owner- The owner of the Preferencescope- What kind of Preference it iskey- The Preference key- Returns:
- A Collection of Preferences, never null
-
findForScopeOwnerGroupName
List<PreferenceEO> findForScopeOwnerGroupName(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String groupName) Find and return allPreferences that belong to a group with the samegroupName.- Parameters:
owner- The owner of the Preferencescope- What kind of Preference it isgroupName- The name of the group- Returns:
- All instances, never null
-
existsForOwnerAndScopeAndKey
boolean existsForOwnerAndScopeAndKey(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String key) Checks whether aPreferenceof a specificscopethat belongs to the givenownerand has the givenkeyexists.- Parameters:
owner- The owner of the Preferencescope- What kind of Preference it iskey- The Preference key- Returns:
- true if it does exist, otherwise false
-
create
Create a new non-existingPreference.- Parameters:
preference- The instance to create- Returns:
- The created instance
- Throws:
org.ameba.exception.ResourceExistsException- in case the passed Preference already exists
-
update
@NotNull @NotNull PreferenceEO update(@NotBlank @NotBlank String pKey, @NotNull @NotNull PreferenceEO preference) Update the given and existingPreference.- Parameters:
pKey- The persistent identifier of the Preference to savepreference- The Preference instance to save- Returns:
- Saved instance
- Throws:
org.ameba.exception.NotFoundException- In case the Preferences does not exist
-
delete
Delete an existingPreference.- Parameters:
pKey- The persistent identifier of the Preference to delete.
-
reloadInitialPreferences
void reloadInitialPreferences()LoadPreferencesfrom file and merge them with the ones in the persistent store.
-