cancel
Showing results for 
Search instead for 
Did you mean: 

Activity feed and ActivityFeedDAOImpl explanation

flavio_russell
Champ in-the-making
Champ in-the-making
Hi,
I'm working with alfresco 4.1.4; I noticed some inconsistencies in the site activities dashlet.

The dashlet shows the activities back to 4 days even if the 28 days filter is set (I'm sure there were activities for the site).

There are a lot of differences if you retrieve the feeds by site (/alfresco/service/api/activities/feed/site/{siteId}) or by user (/alfresco/service/api/activities/feed/user?s={siteId?})

Trying to go deeper I ended here in the ActivityFeedDAOImpl

return (List<ActivityFeedEntity>)template.selectList("alfresco.activities.select.select_activity_feed_for_feeduser", params, rowBounds);

return (List<ActivityFeedEntity>)template.selectList("alfresco.activities.select.select_activity_feed_for_site", params, rowBounds);

I'm trying to understand if the problem is the query that retrieves the activities (i.e. some clause I think to remember in an older implementation sometimes the activities were filtered over preferences (favourite marked)) or if there have been a problem saving the activities for the users.

Can someone explain the logic or the implementation of the activities saved/retrieved?

Thanks

Flavio

2 REPLIES 2

chakib
Champ in-the-making
Champ in-the-making
I found what was wrong with my alfresco server.

What i wanted is the following behaviour:
  • for the dashlet a history of 31 days.
  • for the news Feed only the activities from the last day.
The correct setting is
Feed Notifier Enabled: Yes
Repeat Interval (mins): 1440
Maximum Age (mins): 44640
Maximum Size: 100

With those settings i didn't got the notification mails right. The notification mails where not sended every day. Even though, there were lot's of actions made in the server to send notifications about.
I digged into the code of the class
EmailUserNotifier
and
AbstractUserNotifier
. And i saw that a field feedDBID is use in order to send only new actions in the notification mail.

that feedDBID is stored per user and in my case was not synched with the database.
For my user i had a value of 158432 and the biggest id in the table alf_activity_feed was 562.
For the creation of the notification email the process takes only the feed that have ids bigger than the FeedDBID.

After a backup of the database I did a reset of all the feedDBID so that field could be properly synced again.
i used this:
<code lang="sql">
delete from 415alf.alf_node_properties
where qname_id=126;
</code>

415alf being the database name.


<strong>TL;DR: </strong>

if you have issue with the notification emails and activity dashlets here what you can do.
in the administration pannel -> Activities Feed
The correct setting is
Feed Notifier Enabled: Yes
Repeat Interval (mins): 1440
Maximum Age (mins): 44640
Maximum Size: 100

then after a good database backup :
<code lang="sql">
delete from 415alf.alf_node_properties
where qname_id=126;
</code>

chakib
Champ in-the-making
Champ in-the-making
Precision on how i got the feeddbid from the database:
for every user
<blockcode>
SELECT anp1.node_id,
       anp1.qname_id,
       anp1.long_value as feedDBID ,
       anp2.string_value as user_string
FROM alf415db.alf_node_properties anp1
        INNER JOIN alf415db.alf_qname aq1
           ON aq1.id       = anp1.qname_id
        INNER JOIN alf415db.alf_node_properties anp2
           ON anp2.node_id = anp1.node_id
        INNER JOIN alf415db.alf_qname aq2          
           ON aq2.id       = anp2.qname_id
WHERE aq1.local_name    = 'emailFeedId'
AND aq2.local_name    = 'username';
</blockcode>

for a specific user

<blockcode>
SELECT anp1.node_id,
       anp1.qname_id,
       anp1.long_value as feedDBID ,
       anp2.string_value as user_string
FROM alf415db.alf_node_properties anp1
        INNER JOIN alf415db.alf_qname aq1
           ON aq1.id       = anp1.qname_id
        INNER JOIN alf415db.alf_node_properties anp2
           ON anp2.node_id = anp1.node_id
        INNER JOIN alf415db.alf_qname aq2           
           ON aq2.id       = anp2.qname_id
WHERE aq1.local_name    = 'emailFeedId'
AND aq2.local_name    = 'username'
and anp2.string_value = 'elidrisc';
</blockcode>