Search in sources :

Example 1 with ActivityMap

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);
                    }
                }
            }
        }
    }
}
Also used : ActivityMap(org.activityinfo.server.digest.activity.ActivityDigestModel.ActivityMap) PartnerActivityModel(org.activityinfo.server.digest.activity.ActivityDigestModel.PartnerActivityModel) DatabaseModel(org.activityinfo.server.digest.activity.ActivityDigestModel.DatabaseModel) User(org.activityinfo.server.database.hibernate.entity.User) SiteHistory(org.activityinfo.server.database.hibernate.entity.SiteHistory) Partner(org.activityinfo.server.database.hibernate.entity.Partner)

Example 2 with 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);
        }
    }
}
Also used : ActivityMap(org.activityinfo.server.digest.activity.ActivityDigestModel.ActivityMap) PartnerActivityModel(org.activityinfo.server.digest.activity.ActivityDigestModel.PartnerActivityModel)

Aggregations

ActivityMap (org.activityinfo.server.digest.activity.ActivityDigestModel.ActivityMap)2 PartnerActivityModel (org.activityinfo.server.digest.activity.ActivityDigestModel.PartnerActivityModel)2 Partner (org.activityinfo.server.database.hibernate.entity.Partner)1 SiteHistory (org.activityinfo.server.database.hibernate.entity.SiteHistory)1 User (org.activityinfo.server.database.hibernate.entity.User)1 DatabaseModel (org.activityinfo.server.digest.activity.ActivityDigestModel.DatabaseModel)1