use of fi.otavanopisto.muikku.schooldata.entity.UserGroup in project muikku by otavanopisto.
the class SchoolDataSearchReindexListener method reindexUserGroups.
private boolean reindexUserGroups() {
try {
List<UserGroupEntity> userGroups = userGroupEntityController.listUserGroupEntities();
int groupIndex = getOffset("groupIndex");
if (groupIndex < userGroups.size()) {
int last = Math.min(userGroups.size(), groupIndex + getBatchSize());
for (int i = groupIndex; i < last; i++) {
UserGroupEntity groupEntity = userGroups.get(i);
UserGroup userGroup = userGroupController.findUserGroup(groupEntity.getSchoolDataSource(), groupEntity.getIdentifier());
try {
indexer.index(UserGroup.class.getSimpleName(), userGroup);
} catch (Exception e) {
logger.log(Level.WARNING, "could not index UserGroup #" + groupEntity.getSchoolDataSource() + '/' + groupEntity.getIdentifier(), e);
}
}
logger.log(Level.INFO, "Reindexed batch of usergroups (" + groupIndex + "-" + last + ")");
setOffset("groupIndex", groupIndex + getBatchSize());
return false;
} else
return true;
} catch (Exception ex) {
logger.log(Level.SEVERE, "Could not finish indexing usergroup entities.", ex);
return true;
}
}
Aggregations