use of teammates.ui.pagedata.AdminSearchPageData in project teammates by TEAMMATES.
the class AdminSearchPageAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
String searchKey = getRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_KEY);
String searchButtonHit = getRequestParamValue(Const.ParamsNames.ADMIN_SEARCH_BUTTON_HIT);
AdminSearchPageData data = new AdminSearchPageData(account, sessionToken);
if (searchKey == null || searchKey.trim().isEmpty()) {
if (searchButtonHit == null) {
statusToAdmin = "AdminSearchPage Page Load";
} else {
statusToUser.add(new StatusMessage("Search key cannot be empty", StatusMessageColor.WARNING));
statusToAdmin = "Invalid Search: Search key cannot be empty";
isError = true;
}
return createShowPageResult(Const.ViewURIs.ADMIN_SEARCH, data);
}
data.searchKey = SanitizationHelper.sanitizeForHtml(searchKey);
data.studentResultBundle = logic.searchStudentsInWholeSystem(searchKey);
data = putFeedbackSessionLinkIntoMap(data.studentResultBundle.studentList, data);
data = putStudentHomePageLinkIntoMap(data.studentResultBundle.studentList, data);
data = putStudentRecordsPageLinkIntoMap(data.studentResultBundle.studentList, data);
data = putStudentInstituteIntoMap(data.studentResultBundle.studentList, data);
data.instructorResultBundle = logic.searchInstructorsInWholeSystem(searchKey);
data = putInstructorInstituteIntoMap(data.instructorResultBundle.instructorList, data);
data = putInstructorHomePageLinkIntoMap(data.instructorResultBundle.instructorList, data);
data = putInstructorCourseJoinLinkIntoMap(data.instructorResultBundle.instructorList, data);
data = putCourseNameIntoMap(data.studentResultBundle.studentList, data.instructorResultBundle.instructorList, data);
int numOfResults = data.studentResultBundle.numberOfResults + data.instructorResultBundle.numberOfResults;
if (numOfResults > 0) {
statusToUser.add(new StatusMessage("Total results found: " + numOfResults, StatusMessageColor.INFO));
statusToAdmin = "Search Key: " + data.searchKey + "<br>" + "Total results found: " + numOfResults;
isError = false;
} else {
statusToUser.add(new StatusMessage("No result found, please try again", StatusMessageColor.WARNING));
statusToAdmin = "Search Key: " + data.searchKey + "<br>" + "No result found";
isError = true;
}
data.init();
return createShowPageResult(Const.ViewURIs.ADMIN_SEARCH, data);
}
Aggregations