use of org.activityinfo.shared.dto.ActivityDTO in project activityinfo by bedatadriven.
the class LockedPeriodSet method indexLocks.
private void indexLocks(UserDatabaseDTO db) {
for (ActivityDTO activity : db.getActivities()) {
addEnabled(activityLocks, activity.getId(), db.getLockedPeriods());
addEnabled(activityLocks, activity.getId(), activity.getLockedPeriods());
}
for (ProjectDTO project : db.getProjects()) {
addEnabled(projectLocks, project.getId(), project.getLockedPeriods());
}
}
use of org.activityinfo.shared.dto.ActivityDTO in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addActivityColumn.
public ColumnModelBuilder addActivityColumn(final UserDatabaseDTO database) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = database.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getName();
}
});
columns.add(config);
return this;
}
use of org.activityinfo.shared.dto.ActivityDTO in project activityinfo by bedatadriven.
the class ColumnModelBuilder method addDatabaseColumn.
public ColumnModelBuilder addDatabaseColumn(final SchemaDTO schema) {
ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.activity(), 100);
config.setRenderer(new GridCellRenderer<SiteDTO>() {
@Override
public Object render(SiteDTO model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<SiteDTO> store, Grid<SiteDTO> grid) {
ActivityDTO activity = schema.getActivityById(model.getActivityId());
return activity == null ? "" : activity.getDatabase().getName();
}
});
columns.add(config);
return this;
}
use of org.activityinfo.shared.dto.ActivityDTO in project activityinfo by bedatadriven.
the class SearchPresenter method fromSitesList.
private List<RecentSiteModel> fromSitesList(List<SiteDTO> sites) {
List<RecentSiteModel> result = new ArrayList<RecentSiteModel>();
if (sites != null) {
for (SiteDTO site : sites) {
RecentSiteModel recent = null;
if (schema != null) {
ActivityDTO activity = schema.getActivityById(site.getActivityId());
if (activity != null) {
recent = new RecentSiteModel(site);
recent.setActivityName(activity.getName());
recent.setActivityLink(PageStateSerializer.asLink(new DataEntryPlace(activity)));
recent.setDatabaseName(activity.getDatabase().getName() == null ? "[Database]" : activity.getDatabase().getName());
}
}
if (recent != null) {
result.add(recent);
}
}
}
return result;
}
use of org.activityinfo.shared.dto.ActivityDTO in project activityinfo by bedatadriven.
the class DimensionPruner method getSelectedActivities.
private Set<ActivityDTO> getSelectedActivities(SchemaDTO schema) {
Set<ActivityDTO> activities = Sets.newHashSet();
Set<Integer> indicatorIds = Sets.newHashSet(model.getFilter().getRestrictions(DimensionType.Indicator));
for (UserDatabaseDTO db : schema.getDatabases()) {
for (ActivityDTO activity : db.getActivities()) {
for (IndicatorDTO indicator : activity.getIndicators()) {
if (indicatorIds.contains(indicator.getId())) {
activities.add(activity);
}
}
}
}
return activities;
}
Aggregations