Package com.jalios.jcms.memberpreference
Class MemberPreferenceManager
- java.lang.Object
-
- com.jalios.jcms.memberpreference.MemberPreferenceManager
-
- All Implemented Interfaces:
DBConstants
,JPropertiesListener
public class MemberPreferenceManager extends java.lang.Object implements JPropertiesListener, DBConstants
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CACHE_ENABLED_PROP
static java.lang.String
CACHE_MAX_ENTRIES_PROP
static java.lang.String
PROPERTY_PREFIX
-
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, ATTACH_WS_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_ATTACH_WS_FIELD, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_HAS_ATTACH_WS, HIBERNATE_MAPPING_HASNOREADRIGHTS, HIBERNATE_MAPPING_MAININSTANCE_ID, HIBERNATE_MAPPING_MAJORVERSION, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_MERGE_DATE, HIBERNATE_MAPPING_MERGE_ID, HIBERNATE_MAPPING_MINORVERSION, HIBERNATE_MAPPING_OPAUTHOR, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_READ_ACK, HIBERNATE_MAPPING_READERCOUNT, HIBERNATE_MAPPING_RESTRICTIVE_UPDATE_RIGHTS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_TRACKED, HIBERNATE_MAPPING_UDATE, HIBERNATE_MAPPING_VOTECOUNT, HIBERNATE_MAPPING_VOTESCORE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MAX_HIBERNATE_MAPPING_PUBLICATION, MDATE_FIELD, OPAUTHOR_ID_FIELD, PSTATUS_FIELD, REVISION, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
-
Fields inherited from interface com.jalios.util.JPropertiesListener
REVISION
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultPreference(java.lang.String key)
Returns the default value for the given preferencestatic MemberPreferenceManager
getInstance()
java.util.List<MemberPreference>
getMemberPreferenceList(Member mbr)
Returns all the MemberPreference of the given member.java.lang.String
getPreference(Member mbr, java.lang.String key)
Returns the given preference for the given member (use default if any)java.lang.String
getPreference(Member mbr, java.lang.String key, boolean useDefault)
Returns the given preference for the given membervoid
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.void
removeAllPreferences(Member mbr)
Remove all the preferences of the given member.void
removePreference(Member mbr, java.lang.String key)
Remove a member preference for a given membervoid
resetCache()
Reset the cache.void
saveDefaultPreference(java.lang.String key, java.lang.String value)
void
savePreference(Member mbr, java.lang.String key, java.lang.String value)
Save the preference (key/value) for the given member.
-
-
-
Field Detail
-
PROPERTY_PREFIX
public static final java.lang.String PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
CACHE_ENABLED_PROP
public static final java.lang.String CACHE_ENABLED_PROP
- See Also:
- Constant Field Values
-
CACHE_MAX_ENTRIES_PROP
public static final java.lang.String CACHE_MAX_ENTRIES_PROP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static MemberPreferenceManager getInstance()
-
propertiesChange
public void propertiesChange(JProperties properties)
Description copied from interface:JPropertiesListener
Invoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getProperties
orchannel.getProperty
.- Specified by:
propertiesChange
in interfaceJPropertiesListener
- Parameters:
properties
- the properties which have been submitted to change
-
getPreference
public java.lang.String getPreference(Member mbr, java.lang.String key)
Returns the given preference for the given member (use default if any)- Parameters:
mbr
- the memberkey
- the key of the preference- Returns:
- the given preference for the given member
- Since:
- jcms-10.0.0
-
getPreference
public java.lang.String getPreference(Member mbr, java.lang.String key, boolean useDefault)
Returns the given preference for the given member- Parameters:
mbr
- the memberkey
- the key of the preferenceuseDefault
- if true and there is no preference fo the given member, search for a default preference- Returns:
- the given preference for the given member
- Since:
- jcms-10.0.0
-
getDefaultPreference
public java.lang.String getDefaultPreference(java.lang.String key)
Returns the default value for the given preference- Parameters:
key
- the key of the preference- Returns:
- the given preference for the given member
- Since:
- jcms-10.0.0
-
getMemberPreferenceList
public java.util.List<MemberPreference> getMemberPreferenceList(Member mbr)
Returns all the MemberPreference of the given member.- Parameters:
mbr
- the member.- Returns:
- all the MemberPreference of the given member.
- Since:
- jcms-10.0.0
-
savePreference
public void savePreference(Member mbr, java.lang.String key, java.lang.String value)
Save the preference (key/value) for the given member.- Parameters:
mbr
- the memberkey
- the key of the preferencevalue
- the value of the preference- Since:
- jcms-10.0.0
-
saveDefaultPreference
public void saveDefaultPreference(java.lang.String key, java.lang.String value)
-
removeAllPreferences
public void removeAllPreferences(Member mbr)
Remove all the preferences of the given member.- Parameters:
mbr
- the member- Since:
- jcms-10.0.0
-
removePreference
public void removePreference(Member mbr, java.lang.String key)
Remove a member preference for a given member- Parameters:
mbr
- the memberkey
- the key of the preference- Since:
- jcms-10.0.3
-
resetCache
public void resetCache()
Reset the cache. A new cache is initialized.- Since:
- jcms-10.0.1
-
-