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 PreferenceEO
create
(@NotNull PreferenceEO preference) Create a new non-existingPreference
.void
Delete an existingPreference
.boolean
existsForOwnerAndScopeAndKey
(String owner, @NotNull PropertyScope scope, @NotBlank String key) Checks whether aPreference
of a specificscope
that belongs to the givenowner
and has the givenkey
exists.@NotNull Collection
<PreferenceEO> findAll()
Find and return allPreferences
.@NotNull PreferenceEO
findByPKey
(@NotBlank String pKey) Find and return thePreferences
identified by thepKey
.@NotNull Collection
<PreferenceEO> findForOwnerAndScope
(String owner, @NotNull PropertyScope scope) Find and return allPreferences
of a specificscope
that belong to the givenowner
.findForOwnerAndScopeAndKey
(String owner, @NotNull PropertyScope scope, @NotBlank String key) Find and return thePreference
of a specificscope
that belongs to the givenowner
and has the givenkey
.findForScopeOwnerGroupName
(String owner, @NotNull PropertyScope scope, @NotBlank String groupName) Find and return allPreference
s that belong to a group with the samegroupName
.void
LoadPreferences
from file and merge them with the ones in the persistent store.@NotNull PreferenceEO
update
(@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 thePreferences
identified 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 allPreferences
of a specificscope
that 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 thePreference
of a specificscope
that belongs to the givenowner
and 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 allPreference
s 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 aPreference
of a specificscope
that belongs to the givenowner
and has the givenkey
exists.- 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()LoadPreferences
from file and merge them with the ones in the persistent store.
-