use of org.activityinfo.server.digest.activity.ActivityDigestModel.ActivityMap in project activityinfo by bedatadriven.
the class ActivityDigestModelBuilder method createDatabaseModel.
private void createDatabaseModel(ActivityDigestModel model, Database database) {
SiteHistory lastEdit = findLastEdit(database);
// only include databases that are known to be edited at least once
if (lastEdit != null) {
DatabaseModel databaseModel = new DatabaseModel(model, database, lastEdit);
List<SiteHistory> ownerHistories = findSiteHistory(databaseModel, database.getOwner());
ActivityMap ownerActivityMap = new ActivityMap(databaseModel, database.getOwner(), ownerHistories);
databaseModel.setOwnerActivityMap(ownerActivityMap);
List<Partner> partners = findPartners(databaseModel);
LOGGER.finest("building user activity digest for user " + model.getUserDigest().getUser().getId() + " and database " + database.getId() + " - found " + partners.size() + " partner(s)");
if (!partners.isEmpty()) {
for (Partner partner : partners) {
PartnerActivityModel partnerModel = new PartnerActivityModel(databaseModel, partner);
List<User> partnerUsers = findUsers(partnerModel);
LOGGER.finest("found users " + partnerUsers + " for partner " + partner.getName());
if (!partnerUsers.isEmpty()) {
for (User partnerUser : partnerUsers) {
List<SiteHistory> histories = findSiteHistory(databaseModel, partnerUser);
ActivityMap activityMap = new ActivityMap(databaseModel, partnerUser, histories);
partnerModel.addActivityMap(activityMap);
}
}
}
}
}
}
use of org.activityinfo.server.digest.activity.ActivityDigestModel.ActivityMap in project activityinfo by bedatadriven.
the class ActivityDigestRenderer method renderActiveDatabase.
private void renderActiveDatabase(StringBuilder html, DatabaseModel activeDatabase) {
renderDatabaseRow(html, 2 + activeDatabase.getModel().getUserDigest().getDays(), activeDatabase.getName());
renderUserRow(html, activeDatabase.getOwnerActivityMap());
for (PartnerActivityModel partnerModel : activeDatabase.getPartnerActivityModels()) {
renderPartnerRow(html, partnerModel);
for (ActivityMap activityMap : partnerModel.getActivityMaps()) {
renderUserRow(html, activityMap);
}
}
}
Aggregations