use of teammates.common.util.GaeLogApi in project teammates by TEAMMATES.
the class AdminEmailLogPageAction method searchEmailLogsWithTimeIncrement.
/**
* Searches enough email logs within MAX_SEARCH_PERIOD hours.
*/
private void searchEmailLogsWithTimeIncrement(AdminEmailLogPageData data) {
List<EmailLogEntry> emailLogs = new LinkedList<>();
List<String> versionToQuery = getVersionsForQuery(data.getVersions());
AdminLogQuery query = new AdminLogQuery(versionToQuery, null, data.getToDate());
int totalLogsSearched = 0;
GaeLogApi logApi = new GaeLogApi();
long startTime = query.getEndTime() - SEARCH_TIME_INCREMENT;
query.setTimePeriod(startTime, query.getEndTime());
for (int i = 0; i < MAX_SEARCH_TIMES; i++) {
if (emailLogs.size() >= LOGS_PER_PAGE) {
break;
}
List<AppLogLine> searchResult = logApi.fetchLogs(query);
List<EmailLogEntry> filteredLogs = filterLogsForEmailLogPage(searchResult, data);
emailLogs.addAll(filteredLogs);
totalLogsSearched += searchResult.size();
query.moveTimePeriodBackward(SEARCH_TIME_INCREMENT);
}
data.setLogs(emailLogs);
long nextEndTimeToSearch = query.getEndTime();
String status = " Total Logs gone through in last search: " + totalLogsSearched + "<br>" + "<button class=\"btn-link\" id=\"button_older\" data-next-end-time-to-search=\"" + nextEndTimeToSearch + "\">Search More</button>";
data.setStatusForAjax(status);
statusToUser.add(new StatusMessage(status, StatusMessageColor.INFO));
}
use of teammates.common.util.GaeLogApi in project teammates by TEAMMATES.
the class AdminActivityLogPageAction method searchLogsWithExactTimePeriod.
/**
* Retrieves all logs in the time period specified in the query.
*/
private List<ActivityLogEntry> searchLogsWithExactTimePeriod(AdminLogQuery query, AdminActivityLogPageData data) {
GaeLogApi logApi = new GaeLogApi();
List<AppLogLine> searchResult = logApi.fetchLogs(query);
nextEndTimeToSearch = data.getFromDate() - 1;
totalLogsSearched = searchResult.size();
return filterLogsForActivityLogPage(searchResult, data);
}
use of teammates.common.util.GaeLogApi in project teammates by TEAMMATES.
the class AdminActivityLogPageAction method searchLogsWithTimeIncrement.
/**
* Retrieves enough logs within MAX_SEARCH_PERIOD hours.
*/
private List<ActivityLogEntry> searchLogsWithTimeIncrement(AdminLogQuery query, AdminActivityLogPageData data) {
List<ActivityLogEntry> appLogs = new LinkedList<>();
totalLogsSearched = 0;
GaeLogApi logApi = new GaeLogApi();
long startTime = query.getEndTime() - SEARCH_TIME_INCREMENT;
query.setTimePeriod(startTime, query.getEndTime());
for (int i = 0; i < MAX_SEARCH_TIMES; i++) {
if (appLogs.size() >= RELEVANT_LOGS_PER_PAGE) {
break;
}
List<AppLogLine> searchResult = logApi.fetchLogs(query);
List<ActivityLogEntry> filteredLogs = filterLogsForActivityLogPage(searchResult, data);
appLogs.addAll(filteredLogs);
totalLogsSearched += searchResult.size();
query.moveTimePeriodBackward(SEARCH_TIME_INCREMENT);
}
data.setFromDate(query.getStartTime() + SEARCH_TIME_INCREMENT);
nextEndTimeToSearch = query.getEndTime();
return appLogs;
}
use of teammates.common.util.GaeLogApi in project teammates by TEAMMATES.
the class AdminEmailLogPageAction method searchEmailLogsWithExactTimePeriod.
/**
* Searches all logs in the time period specified in the query.
*/
private void searchEmailLogsWithExactTimePeriod(AdminEmailLogPageData data) {
List<String> versionToQuery = getVersionsForQuery(data.getVersions());
AdminLogQuery query = new AdminLogQuery(versionToQuery, data.getFromDate(), data.getToDate());
List<AppLogLine> searchResult = new GaeLogApi().fetchLogs(query);
data.setLogs(filterLogsForEmailLogPage(searchResult, data));
long nextEndTimeToSearch = data.getFromDate() - 1;
int totalLogsSearched = searchResult.size();
String status = " Total Logs gone through in last search: " + totalLogsSearched + "<br>" + "<button class=\"btn-link\" id=\"button_older\" data-next-end-time-to-search=\"" + nextEndTimeToSearch + "\">Search More</button>";
data.setStatusForAjax(status);
statusToUser.add(new StatusMessage(status, StatusMessageColor.INFO));
}
Aggregations