Search in sources :

Example 1 with AdminAccountManagementPageData

use of teammates.ui.pagedata.AdminAccountManagementPageData in project teammates by TEAMMATES.

the class AdminAccountManagementPageAction method execute.

@Override
protected ActionResult execute() {
    gateKeeper.verifyAdminPrivileges(account);
    String instructorGoogleId = this.getRequestParamValue("googleId");
    if (instructorGoogleId == null) {
        instructorGoogleId = "";
    }
    Map<String, ArrayList<InstructorAttributes>> instructorCoursesTable = new HashMap<>();
    Map<String, AccountAttributes> instructorAccountsTable = new HashMap<>();
    List<InstructorAttributes> instructorsList = logic.getInstructorsForGoogleId(instructorGoogleId);
    AccountAttributes instructorAccount = logic.getAccount(instructorGoogleId);
    boolean isToShowAll = this.getRequestParamAsBoolean("all");
    boolean isAccountExisting = instructorAccount != null;
    if (isAccountExisting) {
        instructorAccountsTable.put(instructorAccount.googleId, instructorAccount);
        for (InstructorAttributes instructor : instructorsList) {
            ArrayList<InstructorAttributes> courseList = instructorCoursesTable.get(instructor.googleId);
            if (courseList == null) {
                courseList = new ArrayList<>();
                instructorCoursesTable.put(instructor.googleId, courseList);
            }
            courseList.add(instructor);
        }
    }
    AdminAccountManagementPageData data = new AdminAccountManagementPageData(account, sessionToken, instructorAccountsTable, instructorCoursesTable, isToShowAll);
    statusToAdmin = "Admin Account Management Page Load<br>" + "<span class=\"bold\">Total Instructors:</span> " + instructorAccountsTable.size();
    return createShowPageResult(Const.ViewURIs.ADMIN_ACCOUNT_MANAGEMENT, data);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) AdminAccountManagementPageData(teammates.ui.pagedata.AdminAccountManagementPageData)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 AdminAccountManagementPageData (teammates.ui.pagedata.AdminAccountManagementPageData)1