use of org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamLikeInfo in project entando-core by entando.
the class SocialActivityStreamManager method getActionLikeRecords.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamLikeRecords_id_'.concat(#id)")
@CacheableInfo(groups = "'ActivityStreamLikeRecords_cacheGroup'")
public List<ActivityStreamLikeInfo> getActionLikeRecords(int id) throws ApsSystemException {
List<ActivityStreamLikeInfo> infos = null;
try {
infos = this.getSocialActivityStreamDAO().getActionLikeRecords(id);
if (null != infos) {
for (int i = 0; i < infos.size(); i++) {
ActivityStreamLikeInfo asli = infos.get(i);
String username = asli.getUsername();
IUserProfile profile = this.getUserProfileManager().getProfile(username);
String displayName = (null != profile) ? profile.getDisplayName() : username;
asli.setDisplayName(displayName);
}
}
} catch (Throwable t) {
_logger.error("Error extracting activity stream like records", t);
throw new ApsSystemException("Error extracting activity stream like records", t);
}
return infos;
}
use of org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamLikeInfo in project entando-core by entando.
the class SocialActivityStreamDAO method getActionLikeRecords.
@Override
public List<ActivityStreamLikeInfo> getActionLikeRecords(int id) {
List<ActivityStreamLikeInfo> infos = new ActivityStreamLikeInfos();
Connection conn = null;
PreparedStatement stat = null;
ResultSet result = null;
try {
conn = this.getConnection();
stat = conn.prepareStatement(GET_ACTION_LIKE_RECORDS);
stat.setInt(1, id);
result = stat.executeQuery();
while (result.next()) {
ActivityStreamLikeInfo asli = new ActivityStreamLikeInfo();
asli.setUsername(result.getString(1));
infos.add(asli);
}
} catch (Throwable t) {
logger.error("Error while loading activity stream like records", t);
throw new RuntimeException("Error while loading activity stream like records", t);
} finally {
closeDaoResources(result, stat, conn);
}
return infos;
}
Aggregations