com.jalios.jcms.tracking
Class ReaderTrackerManager

java.lang.Object
  extended by com.jalios.jcms.db.BasicDBListener
      extended by com.jalios.jcms.tracking.ReaderTrackerManager
All Implemented Interfaces:
DBConstants, DBListener, PluginComponent, JaliosConstants, JPropertiesListener

public class ReaderTrackerManager
extends BasicDBListener
implements JaliosConstants, DBConstants, JPropertiesListener

Author:
bransard

Nested Class Summary
 class ReaderTrackerManager.CacheEntry
           
 
Field Summary
static String READER_TRACKER_ANONYMIZE_PROP
           
static String READER_TRACKER_ENABLED_PROP
           
static String READER_TRACKER_TYPES_PROP
           
static String REVISION
           
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MDATE_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
 
Method Summary
 void anonymizeAllReaderTracker(Member mbr)
           
 boolean canAccessReaderTracker(Publication pub, Member mbr)
           
 boolean canDeleteReaderTracker(Publication pub, Member mbr)
           
 int getAccessCount(List<ReaderTracker> list)
          Returns the sum of access count for the list of ReaderTracker.
 int getAccessCount(Publication pub)
          Returns the sum of access count for the given publication.
 int getAnonymousReaderAccessCount(Publication pub)
           
 int getAnonymousReaderDownloadCount(Publication pub)
           
 int getAuthentifiedReaderAccessCount(Publication pub)
           
 int getAuthentifiedReaderDownloadCount(Publication pub)
           
 int getAuthentifiedReaderUniqueAccessCount(Publication pub)
           
 int getAuthentifiedReaderUniqueDownloadCount(Publication pub)
           
 int getDownloadCount(Publication pub)
          Returns the download count for the given publication for authentified users.
static ReaderTrackerManager getInstance()
           
 List<ReaderTrackerEntry> getMergedReaderTrackerList(List<ReaderTracker> readerList, ReaderTrackerEntry.Sort Sort, boolean isReverse)
           
 List<ReaderTrackerEntry> getMergedReaderTrackerList(Publication pub, ReaderTrackerEntry.Sort Sort, boolean isReverse)
           
 int getReaderAccessCount(Publication pub)
           
 int getReaderCount(Publication pub)
          Returns the reader count for the given publication.
 ReaderTracker getReaderTracker(Publication pub, Member mbr)
          Returns the ReaderTracker for the given Publication and the given Member.
 ReaderTracker getReaderTracker(Publication pub, Member mbr, int accessType)
          Returns the ReaderTracker for the given Publication and the given Member.
 List getReaderTrackerList(Publication pub)
          Returns the reader list for the given publication.
 List getReaderTrackerList(Publication pub, int accessType)
           
 List getReaderTrackerList(Publication pub, String orderBy, boolean reverse, int accessType)
           
 void invalidateAllCacheEntries()
          Invalidate all the cache entries.
 void invalidateCacheEntry(Publication pub)
          Invalidate the cache entries for the given publication
 boolean isReader(Publication pub, Member mbr)
          Returns true if the given publication has been read by the given member.
 boolean isReaderTrackerAnonymized()
           
 boolean isReaderTrackerEnabled()
           
 boolean isTracked(Publication pub)
           
 boolean isTypeReaderTracked(Class clazz)
          Returns true if the given class is reader tracked
 void onPostDelete(DBData data, org.hibernate.event.PostDeleteEvent event, boolean firstTime)
           
 void onPostInsert(DBData data, org.hibernate.event.PostInsertEvent event, boolean firstTime)
           
 void onPostUpdate(DBData data, org.hibernate.event.PostUpdateEvent event, boolean firstTime)
           
 void propertiesChange(JProperties properties)
          Invoked after properties have been modified in JCMS and save on disk.
 void removeAllReaderTracker(Member mbr, boolean anonymize)
          Removes all the ReaderTracekr bound to the given member ; and optionally report all the access of this member as anonymous access.
 void removeAllReaderTracker(Publication pub)
          Removes all the ReaderTracker bound to the given publication.
 void track(Publication pub, Member mbr)
          Tracks the given member for the given publication.
 void track(Publication pub, Member mbr, int accessType)
          Tracks the given member for the given publication and for given access Type.
 
Methods inherited from class com.jalios.jcms.db.BasicDBListener
getAdateFromState, getAuthorIdFromState, getCdateFromState, getEdateFromState, getMdateFromState, getPdateFromState, getPrePstatus, getPrePstatus, getPstatusFromState, hasNoChange, hasNoChange, init, onPreUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READER_TRACKER_ANONYMIZE_PROP

public static final String READER_TRACKER_ANONYMIZE_PROP
See Also:
Constant Field Values

READER_TRACKER_TYPES_PROP

public static final String READER_TRACKER_TYPES_PROP
See Also:
Constant Field Values

READER_TRACKER_ENABLED_PROP

public static final String READER_TRACKER_ENABLED_PROP
See Also:
Constant Field Values

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

getInstance

public static ReaderTrackerManager 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.

Specified by:
propertiesChange in interface JPropertiesListener
Parameters:
properties - the properties which have been modified (may not contain all JCMS properties)
Since:
jcms-8.0.0

isReaderTrackerEnabled

public boolean isReaderTrackerEnabled()
Returns:
true if the property "readertracker.enabled.boolean" is set to true
Since:
jcms-8.0.0

isReaderTrackerAnonymized

public boolean isReaderTrackerAnonymized()
Returns:
true if the property "readertracker.anonymize.boolean" is set to true
Since:
jcms-8.0.0

isTypeReaderTracked

public boolean isTypeReaderTracked(Class clazz)
Returns true if the given class is reader tracked

Parameters:
clazz - the class to check
Returns:
boolean true if the given class is compatible

isTracked

public boolean isTracked(Publication pub)
Parameters:
pub - the Publication
Returns:
true if given Publication is tracked and reader tracker is enabled
Since:
jcms-8.0.0

getReaderCount

public int getReaderCount(Publication pub)
Returns the reader count for the given publication.

Parameters:
pub - the publication
Returns:
the reader count for the given publication.
Since:
jcms-6.0.0

getReaderAccessCount

public int getReaderAccessCount(Publication pub)
Parameters:
pub - the Publication
Returns:
count of access for the given Publication
Since:
jcms-8.0.0

getAuthentifiedReaderUniqueAccessCount

public int getAuthentifiedReaderUniqueAccessCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the count of unique authentified users who have read the given Publication
Since:
jcms-8.0.0

getAuthentifiedReaderAccessCount

public int getAuthentifiedReaderAccessCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the count of authentified users who have read the given Publication
Since:
jcms-8.0.0

getAnonymousReaderAccessCount

public int getAnonymousReaderAccessCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the count of anonymous users who have accessed the given Publication
Since:
jcms-8.0.0

getReaderTrackerList

public List getReaderTrackerList(Publication pub)
Returns the reader list for the given publication.

Parameters:
pub - the publication
Returns:
the reader list for the given publication.
Since:
jcms-6.0.0

getReaderTrackerList

public List getReaderTrackerList(Publication pub,
                                 int accessType)
Parameters:
pub -
accessType -
Returns:
the list of ReaderTracker for given access type
Since:
jcms-8.0.0

getReaderTrackerList

public List getReaderTrackerList(Publication pub,
                                 String orderBy,
                                 boolean reverse,
                                 int accessType)
Parameters:
pub - the Publication
orderBy - the orderby of the query
reverse - to defines the order of the query
accessType - the type of access
Returns:
the list of ReaderTracker for given access type and for given parameters
Since:
jcms-8.0.0

getMergedReaderTrackerList

public List<ReaderTrackerEntry> getMergedReaderTrackerList(Publication pub,
                                                           ReaderTrackerEntry.Sort Sort,
                                                           boolean isReverse)
Parameters:
pub - the tracked Publication
Sort - the ReaderTrackerEntry.Sort of the query
isReverse - true to sort results reversed
Returns:
a List of ReaderTrackerEntry which merges a ReaderTracker List to avoid duplicates
Since:
jcms-8.0.0

getMergedReaderTrackerList

public List<ReaderTrackerEntry> getMergedReaderTrackerList(List<ReaderTracker> readerList,
                                                           ReaderTrackerEntry.Sort Sort,
                                                           boolean isReverse)
Parameters:
readerList - the list of ReaderTracker
Sort - the ReaderTrackerEntry.Sort of the query
isReverse - true to sort results reversed
Returns:
a List of ReaderTrackerEntry which merges a ReaderTracker List to avoid duplicates
Since:
jcms-8.0.0

getReaderTracker

public ReaderTracker getReaderTracker(Publication pub,
                                      Member mbr)
Returns the ReaderTracker for the given Publication and the given Member.

Parameters:
pub - the publication
mbr - the member
Returns:
the ReaderTracker for the given Publication and the given Member.
Since:
jcms-6.0.0

getReaderTracker

public ReaderTracker getReaderTracker(Publication pub,
                                      Member mbr,
                                      int accessType)
Returns the ReaderTracker for the given Publication and the given Member.

Parameters:
pub - the publication
mbr - the member
Returns:
the ReaderTracker for the given Publication and the given Member.
Since:
jcms-6.0.0

getDownloadCount

public int getDownloadCount(Publication pub)
Returns the download count for the given publication for authentified users.

Parameters:
pub - the publication
Returns:
the download count for the given publication for authentified users..
Since:
jcms-8.0.0

getAuthentifiedReaderUniqueDownloadCount

public int getAuthentifiedReaderUniqueDownloadCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the count of unique authentified reader who has downloaded the file document
Since:
jcms-8.0.0

getAuthentifiedReaderDownloadCount

public int getAuthentifiedReaderDownloadCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the total count of authenfied reader who has downloaded the file document
Since:
jcms-8.0.0

getAnonymousReaderDownloadCount

public int getAnonymousReaderDownloadCount(Publication pub)
Parameters:
pub - the Publication
Returns:
the count of anonymous reader who has downloaded the file document
Since:
jcms-8.0.0

getAccessCount

public int getAccessCount(Publication pub)
Returns the sum of access count for the given publication.

Parameters:
pub - the publication.
Returns:
the sum of access count for the given publication.
Since:
jcms-6.0.0

getAccessCount

public int getAccessCount(List<ReaderTracker> list)
Returns the sum of access count for the list of ReaderTracker.

Parameters:
list - a list of ReaderTracker
Returns:
the sum of access count for the list of ReaderTracker.
Since:
jcms-6.0.0

isReader

public boolean isReader(Publication pub,
                        Member mbr)
Returns true if the given publication has been read by the given member.

Parameters:
pub - the publication
mbr - the member
Returns:
true if the given publication has been read by the given member.
Since:
jcms-6.0.0

track

public void track(Publication pub,
                  Member mbr)
Tracks the given member for the given publication.

Parameters:
pub - the publication
mbr - the reader to be tracked (may be null)
Since:
jcms-6.0.0

track

public void track(Publication pub,
                  Member mbr,
                  int accessType)
Tracks the given member for the given publication and for given access Type.

Parameters:
pub - the publication
mbr - the reader to be tracked (may be null)
accessType - the type of access
Since:
jcms-8.0.0

removeAllReaderTracker

public void removeAllReaderTracker(Publication pub)
Removes all the ReaderTracker bound to the given publication.

Parameters:
pub - the publication
Since:
jcms-6.0.0

removeAllReaderTracker

public void removeAllReaderTracker(Member mbr,
                                   boolean anonymize)
Removes all the ReaderTracekr bound to the given member ; and optionally report all the access of this member as anonymous access.

Parameters:
mbr - the member
anonymize - if true report all the access of this member as anonymous access.
Since:
jcms-6.0.0

anonymizeAllReaderTracker

public void anonymizeAllReaderTracker(Member mbr)

canAccessReaderTracker

public boolean canAccessReaderTracker(Publication pub,
                                      Member mbr)
Parameters:
pub - the Publication
mbr - the Member
Returns:
true if given Member can access reader tracker list on given Publication
Since:
jcms-8.0.0

canDeleteReaderTracker

public boolean canDeleteReaderTracker(Publication pub,
                                      Member mbr)
Parameters:
pub - the Publication
mbr - the Member
Returns:
true if given Member can delete reader tracker list on given Publication
Since:
jcms-8.0.0

invalidateCacheEntry

public void invalidateCacheEntry(Publication pub)
Invalidate the cache entries for the given publication

Parameters:
pub - the publication id
Since:
jcms-6.1.2

invalidateAllCacheEntries

public void invalidateAllCacheEntries()
Invalidate all the cache entries.

Since:
jcms-6.1.2

onPostInsert

public void onPostInsert(DBData data,
                         org.hibernate.event.PostInsertEvent event,
                         boolean firstTime)
Specified by:
onPostInsert in interface DBListener
Overrides:
onPostInsert in class BasicDBListener
See Also:
DBListener.onPostInsert(DBData, PostInsertEvent, boolean)

onPostUpdate

public void onPostUpdate(DBData data,
                         org.hibernate.event.PostUpdateEvent event,
                         boolean firstTime)
Specified by:
onPostUpdate in interface DBListener
Overrides:
onPostUpdate in class BasicDBListener
See Also:
DBListener.onPostUpdate(DBData, PostUpdateEvent, boolean)

onPostDelete

public void onPostDelete(DBData data,
                         org.hibernate.event.PostDeleteEvent event,
                         boolean firstTime)
Specified by:
onPostDelete in interface DBListener
Overrides:
onPostDelete in class BasicDBListener
See Also:
DBListener.onPostDelete(DBData, PostDeleteEvent, boolean)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.