当前位置: 首页>>代码示例>>Java>>正文


Java Page类代码示例

本文整理汇总了Java中org.iatoki.judgels.play.Page的典型用法代码示例。如果您正苦于以下问题:Java Page类的具体用法?Java Page怎么用?Java Page使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Page类属于org.iatoki.judgels.play包,在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listUsers

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Authenticated(value = {LoggedIn.class, HasRole.class})
@Authorized(value = {"admin"})
@Transactional
public Result listUsers(long pageIndex, String orderBy, String orderDir, String filterString) {
    Page<UserInfo> currentPage = userService.pageUsers(pageIndex, PAGE_SIZE, orderBy, orderDir, filterString);

    LazyHtml content = new LazyHtml(listUsersView.render(currentPage, orderBy, orderDir, filterString));
    content.appendLayout(c -> tabLayout.render(ImmutableList.of(
            new InternalLink(Messages.get("user.users"), routes.UserController.index()),
            new InternalLink(Messages.get("user.unverifiedUsers"), routes.UserController.viewUnverifiedUsers())
    ), c));
    content.appendLayout(c -> headingWithActionLayout.render(Messages.get("user.list"), new InternalLink(Messages.get("commons.create"), routes.UserController.createUser()), c));
    ControllerUtils.getInstance().appendSidebarLayout(content);
    ControllerUtils.getInstance().appendBreadcrumbsLayout(content, ImmutableList.of(
            new InternalLink(Messages.get("user.users"), routes.UserController.index())
    ));
    ControllerUtils.getInstance().appendTemplateLayout(content, "Users");

    ControllerUtils.getInstance().addActivityLog(userActivityService, "Open all users <a href=\"" + "http://" + Http.Context.current().request().host() + Http.Context.current().request().uri() + "\">link</a>.");

    return ControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:23,代码来源:UserController.java

示例2: listUnverifiedUsers

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Authenticated(value = {LoggedIn.class, HasRole.class})
@Authorized(value = {"admin"})
@Transactional
public Result listUnverifiedUsers(long pageIndex, String orderBy, String orderDir, String filterString) {
    Page<UserInfo> currentPage = userService.pageUnverifiedUsers(pageIndex, PAGE_SIZE, orderBy, orderDir, filterString);

    LazyHtml content = new LazyHtml(listUnverifiedUsersView.render(currentPage, orderBy, orderDir, filterString));
    content.appendLayout(c -> tabLayout.render(ImmutableList.of(
            new InternalLink(Messages.get("user.users"), routes.UserController.index()),
            new InternalLink(Messages.get("user.unverifiedUsers"), routes.UserController.viewUnverifiedUsers())
    ), c));
    content.appendLayout(c -> headingLayout.render(Messages.get("user.unverifiedUsers.list"), c));
    ControllerUtils.getInstance().appendSidebarLayout(content);
    ControllerUtils.getInstance().appendBreadcrumbsLayout(content, ImmutableList.of(
            new InternalLink(Messages.get("user.unverifiedUsers"), routes.UserController.viewUnverifiedUsers())
    ));
    ControllerUtils.getInstance().appendTemplateLayout(content, "Users");

    ControllerUtils.getInstance().addActivityLog(userActivityService, "Open unverified users <a href=\"" + "http://" + Http.Context.current().request().host() + Http.Context.current().request().uri() + "\">link</a>.");

    return ControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:23,代码来源:UserController.java

示例3: listClients

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional
public Result listClients(long page, String orderBy, String orderDir, String filterString) {
    Page<Client> currentPage = clientService.pageClients(page, PAGE_SIZE, orderBy, orderDir, filterString);

    LazyHtml content = new LazyHtml(listClientsView.render(currentPage, orderBy, orderDir, filterString));
    content.appendLayout(c -> headingWithActionLayout.render(Messages.get("client.list"), new InternalLink(Messages.get("commons.create"), routes.ClientController.createClient()), c));
    ControllerUtils.getInstance().appendSidebarLayout(content);
    ControllerUtils.getInstance().appendBreadcrumbsLayout(content, ImmutableList.of(
            new InternalLink(Messages.get("client.clients"), routes.ClientController.index())
    ));
    ControllerUtils.getInstance().appendTemplateLayout(content, "Clients");

    ControllerUtils.getInstance().addActivityLog(userActivityService, "Open all clients <a href=\"" + "http://" + Http.Context.current().request().host() + Http.Context.current().request().uri() + "\">link</a>.");

    return ControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:17,代码来源:ClientController.java

示例4: pageClients_OtherPageClientsParameter_ReturnsEmptyPagedClient

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Test
public void pageClients_OtherPageClientsParameter_ReturnsEmptyPagedClient() {
    long pageIndex = 5L;
    long pageSize = 10L;
    String orderBy = "id";
    String orderDir = "asc";
    String filterString = "asdfasdf";

    List<ClientModel> clientModels = Arrays.asList();
    Mockito.when(clientDao.findSortedByFilters(Mockito.eq(orderBy), Mockito.eq(orderDir), Mockito.eq(filterString), Matchers.<Map<SingularAttribute<? super ClientModel, String>, String>> any(), Matchers.<Map<SingularAttribute<? super ClientModel, String>, Set<String>>> any(), Mockito.eq(pageIndex * pageSize), Mockito.eq(pageSize)))
            .thenReturn(clientModels);

    long totalRows = clientModels.size();
    Mockito.when(clientDao.countByFilters(Mockito.eq(filterString), Matchers.<Map<SingularAttribute<? super ClientModel, String>, String>> any(), Matchers.<Map<SingularAttribute<? super ClientModel, String>, Set<String>>> any())).thenReturn(totalRows);

    Page<Client> clientPage = clientService.pageClients(pageIndex, pageSize, orderBy, orderDir, filterString);

    Assert.assertNotNull(clientPage.getData(), "Page data must not be null");
    Assert.assertEquals(clientModels.size(), clientPage.getTotalRowsCount(), "Page total rows count not equal");
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:21,代码来源:ClientServiceImplTest.java

示例5: getPageOfTeamsInContestByCoachJid

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Override
public Page<ContestTeam> getPageOfTeamsInContestByCoachJid(String contestJid, String coachJid, long pageIndex, long pageSize, String orderBy, String orderDir) {
    List<String> teamJidsInContest = contestTeamDao.getJidsInContest(contestJid);

    Map<SingularAttribute<? super ContestTeamCoachModel, ? extends Object>, String> filterColumns = ImmutableMap.of(ContestTeamCoachModel_.coachJid, coachJid);
    Map<SingularAttribute<? super ContestTeamCoachModel, String>, List<String>> filterColumnsIn = ImmutableMap.of(ContestTeamCoachModel_.teamJid, teamJidsInContest);

    long totalRows = contestTeamCoachDao.countByFilters("", filterColumns, filterColumnsIn);
    List<ContestTeamCoachModel> contestTeamCoachModels = contestTeamCoachDao.findSortedByFilters(orderBy, orderDir, "", filterColumns, filterColumnsIn, pageIndex * pageSize, pageSize);

    List<String> teamJids = Lists.transform(contestTeamCoachModels, m -> m.teamJid);
    List<ContestTeamModel> contestTeamModels = contestTeamDao.getByJids(teamJids);

    ImmutableList.Builder<ContestTeam> contestTeamBuilder = ImmutableList.builder();
    for (ContestTeamModel contestTeamModel : contestTeamModels) {
        List<ContestTeamCoachModel> contestTeamCoachesModel = contestTeamCoachDao.getAllByTeamJid(contestTeamModel.jid);
        List<ContestTeamMemberModel> contestTeamMemberModels = contestTeamMemberDao.getAllInTeam(contestTeamModel.jid);

        contestTeamBuilder.add(createContestTeamFromModel(contestTeamModel, contestTeamCoachesModel, contestTeamMemberModels));
    }
    return new Page<>(contestTeamBuilder.build(), totalRows, pageIndex, pageSize);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:23,代码来源:ContestTeamServiceImpl.java

示例6: listPublishedAnnouncements

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional
public Result listPublishedAnnouncements(long contestId, long pageIndex, String orderBy, String orderDir, String filterString) throws ContestNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    if (!ContestControllerUtils.getInstance().isAllowedToEnterContest(contest, IdentityUtils.getUserJid())) {
        return redirect(org.iatoki.judgels.uriel.contest.routes.ContestController.viewContest(contest.getId()));
    }

    Page<ContestAnnouncement> pageOfContestAnnouncements = contestAnnouncementService.getPageOfAnnouncementsInContest(contest.getJid(), pageIndex, PAGE_SIZE, orderBy, orderDir, filterString, ContestAnnouncementStatus.PUBLISHED.name());
    contestAnnouncementService.readContestAnnouncements(IdentityUtils.getUserJid(), pageOfContestAnnouncements.getData().stream().map(c -> c.getJid()).collect(Collectors.toList()), IdentityUtils.getIpAddress());

    LazyHtml content = new LazyHtml(listPublishedAnnouncementsView.render(contest.getId(), pageOfContestAnnouncements, pageIndex, orderBy, orderDir, filterString));
    content.appendLayout(c -> heading3Layout.render(Messages.get("announcement.list"), c));
    if (isAllowedToSuperviseAnnouncements(contest)) {
        appendSubtabsLayout(content, contest);
    }
    ContestControllerUtils.getInstance().appendTabsLayout(content, contest, IdentityUtils.getUserJid());
    UrielControllerUtils.getInstance().appendSidebarLayout(content);
    appendBreadcrumbsLayout(content, contest,
            new InternalLink(Messages.get("announcement.list"), routes.ContestAnnouncementController.viewPublishedAnnouncements(contest.getId()))
    );
    UrielControllerUtils.getInstance().appendTemplateLayout(content, "Contest - Announcements");

    return UrielControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:25,代码来源:ContestAnnouncementController.java

示例7: listAnnouncements

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional(readOnly = true)
public Result listAnnouncements(long contestId, long pageIndex, String orderBy, String orderDir, String filterString) throws ContestNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    if (!isAllowedToSuperviseAnnouncements(contest)) {
        return ContestControllerUtils.getInstance().tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    Page<ContestAnnouncement> pageOfContestAnnouncements = contestAnnouncementService.getPageOfAnnouncementsInContest(contest.getJid(), pageIndex, PAGE_SIZE, orderBy, orderDir, filterString, null);

    LazyHtml content = new LazyHtml(listAnnouncementsView.render(contest.getId(), pageOfContestAnnouncements, pageIndex, orderBy, orderDir, filterString));
    content.appendLayout(c -> heading3WithActionLayout.render(Messages.get("announcement.list"), new InternalLink(Messages.get("commons.create"), routes.ContestAnnouncementController.createAnnouncement(contest.getId())), c));
    appendSubtabsLayout(content, contest);
    ContestControllerUtils.getInstance().appendTabsLayout(content, contest, IdentityUtils.getUserJid());
    UrielControllerUtils.getInstance().appendSidebarLayout(content);
    appendBreadcrumbsLayout(content, contest,
            new InternalLink(Messages.get("announcement.list"), routes.ContestAnnouncementController.viewAnnouncements(contest.getId()))
    );
    UrielControllerUtils.getInstance().appendTemplateLayout(content, "Contest - All Announcements");

    return UrielControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:22,代码来源:ContestAnnouncementController.java

示例8: listAllowedContests

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Authenticated(value = GuestView.class)
@Transactional(readOnly = true)
public Result listAllowedContests(long pageIndex, String orderBy, String orderDir, String filterString) {
    Page<Contest> pageOfContests;
    if (UrielControllerUtils.getInstance().isAdmin()) {
        pageOfContests = contestService.getPageOfContests(pageIndex, PAGE_SIZE, orderBy, orderDir, filterString);
    } else {
        pageOfContests = contestService.getPageOfAllowedContests(pageIndex, PAGE_SIZE, orderBy, orderDir, filterString, IdentityUtils.getUserJid());
    }

    LazyHtml content = new LazyHtml(listContestsView.render(pageOfContests, pageIndex, orderBy, orderDir, filterString));
    if (UrielControllerUtils.getInstance().isAdmin()) {
        content.appendLayout(c -> headingWithActionLayout.render(Messages.get("contest.list"), new InternalLink(Messages.get("commons.create"), org.iatoki.judgels.uriel.contest.routes.ContestController.createContest()), c));
    } else {
        content.appendLayout(c -> headingLayout.render(Messages.get("contest.list"), c));
    }
    UrielControllerUtils.getInstance().appendSidebarLayout(content);
    UrielControllerUtils.getInstance().appendBreadcrumbsLayout(content, ImmutableList.of(
          new InternalLink(Messages.get("contest.contests"), org.iatoki.judgels.uriel.contest.routes.ContestController.index())
    ));
    UrielControllerUtils.getInstance().appendTemplateLayout(content, "Contests");

    return UrielControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:25,代码来源:ContestController.java

示例9: listAddContestants

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional(readOnly = true)
@AddCSRFToken
public Result listAddContestants(long contestId, long pageIndex, String orderBy, String orderDir, String filterString) throws ContestNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    if (!ContestControllerUtils.getInstance().isSupervisorOrAbove(contest, IdentityUtils.getUserJid())) {
        return ContestControllerUtils.getInstance().tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    Page<ContestContestant> contestContestants = contestContestantService.getPageOfContestantsInContest(contest.getJid(), pageIndex, PAGE_SIZE, orderBy, orderDir, filterString);

    boolean canUpdate = !contest.isLocked() && isAllowedToSuperviseContestants(contest);
    boolean canDelete = !contest.isLocked() && ContestControllerUtils.getInstance().isManagerOrAbove(contest, IdentityUtils.getUserJid());

    Form<ContestContestantAddForm> contestContestantCreateForm = Form.form(ContestContestantAddForm.class);
    Form<ContestContestantUploadForm> contestContestantUploadForm = Form.form(ContestContestantUploadForm.class);

    return showlistAddContestant(contestContestants, pageIndex, orderBy, orderDir, filterString, canUpdate, canDelete, contestContestantCreateForm, contestContestantUploadForm, contest);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:19,代码来源:ContestContestantController.java

示例10: listProblems

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional(readOnly = true)
public Result listProblems(long contestId, long page, String sortBy, String orderBy, String filterString) throws ContestNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    if (!isAllowedToSuperviseProblems(contest)) {
        return ContestControllerUtils.getInstance().tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    boolean canDelete = ContestControllerUtils.getInstance().isManagerOrAbove(contest, IdentityUtils.getUserJid());

    Page<ContestProblem> pageOfContestProblems = contestProblemService.getPageOfProblemsInContest(contest.getJid(), page, PAGE_SIZE, sortBy, orderBy, filterString, null);
    List<String> problemJids = pageOfContestProblems.getData().stream().map(cp -> cp.getProblemJid()).collect(Collectors.toList());
    Map<String, String> problemSlugsMap = SandalphonResourceDisplayNameUtils.buildSlugsMap(JidCacheServiceImpl.getInstance().getDisplayNames(problemJids));

    LazyHtml content = new LazyHtml(listProblemsView.render(contest.getId(), pageOfContestProblems, page, sortBy, orderBy, filterString, canDelete, problemSlugsMap));
    content.appendLayout(c -> heading3WithActionsLayout.render(Messages.get("problem.list"), new InternalLink[]{new InternalLink(Messages.get("commons.create"), routes.ContestProblemController.addProblem(contestId)), new InternalLink(Messages.get("problem.refresh"), routes.ContestProblemController.refreshProblems(contestId))}, c));
    appendSubtabsLayout(content, contest);
    ContestControllerUtils.getInstance().appendTabsLayout(content, contest, IdentityUtils.getUserJid());
    UrielControllerUtils.getInstance().appendSidebarLayout(content);
    appendBreadcrumbsLayout(content, contest,
            new InternalLink(Messages.get("problem.list"), routes.ContestProblemController.viewProblems(contest.getId()))
    );
    UrielControllerUtils.getInstance().appendTemplateLayout(content, "Contest - Problems");

    return UrielControllerUtils.getInstance().lazyOk(content);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:26,代码来源:ContestProblemController.java

示例11: listAddSupervisors

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Transactional(readOnly = true)
@AddCSRFToken
public Result listAddSupervisors(long contestId, long pageIndex, String orderBy, String orderDir, String filterString) throws ContestNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    if (!contest.containsModule(ContestModules.SUPERVISOR) || !ContestControllerUtils.getInstance().isSupervisorOrAbove(contest, IdentityUtils.getUserJid())) {
        return ContestControllerUtils.getInstance().tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    Page<ContestSupervisor> pageOfContestSupervisors = contestSupervisorService.getPageOfSupervisorsInContest(contest.getJid(), pageIndex, PAGE_SIZE, orderBy, orderDir, filterString);

    boolean canUpdate = !contest.isLocked() && isAllowedToManageSupervisors(contest);
    boolean canDelete = !contest.isLocked() && ContestControllerUtils.getInstance().isManagerOrAbove(contest, IdentityUtils.getUserJid());

    ContestSupervisorAddForm contestSupervisorCreateData = new ContestSupervisorAddForm();
    contestSupervisorCreateData.isAllowedAll = true;
    contestSupervisorCreateData.allowedPermissions = Lists.newArrayList(ContestPermissions.values()).stream().collect(Collectors.toMap(p -> p.name(), p -> p.name()));

    Form<ContestSupervisorAddForm> contestSupervisorCreateForm = Form.form(ContestSupervisorAddForm.class).fill(contestSupervisorCreateData);

    return showlistAddSupervisor(pageOfContestSupervisors, pageIndex, orderBy, orderDir, filterString, canUpdate, canDelete, contestSupervisorCreateForm, contest);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:22,代码来源:ContestSupervisorController.java

示例12: pageUsers

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Override
public Page<UserInfo> pageUsers(long pageIndex, long pageSize, String orderBy, String orderDir, String filterString) {
    List<String> userUserJid = userDao.findUserJidsByFilter(filterString);
    List<String> emailUserJid = userEmailDao.findUserJidsByFilter(filterString);

    ImmutableSet.Builder<String> setBuilder = ImmutableSet.builder();
    setBuilder.addAll(userUserJid);
    setBuilder.addAll(emailUserJid);

    ImmutableSet<String> userJidSet = setBuilder.build();
    long totalRow = userJidSet.size();
    ImmutableList.Builder<UserInfo> listBuilder = ImmutableList.builder();

    if (totalRow > 0) {
        List<String> sortedUserJids;
        if (orderBy.equals("email")) {
            sortedUserJids = userEmailDao.sortUserJidsByEmail(userJidSet, orderBy, orderDir);
        } else {
            sortedUserJids = userDao.sortUserJidsByUserAttribute(userJidSet, orderBy, orderDir);
        }

        List<UserModel> userModels = userDao.findBySetOfUserJids(sortedUserJids, pageIndex * pageSize, pageSize);
        List<UserEmailModel> userEmailModels = userEmailDao.findBySetOfUserJids(sortedUserJids, pageIndex * pageSize, pageSize);

        for (int i = 0; i < userModels.size(); ++i) {
            UserModel userModel = userModels.get(i);
            UserEmailModel userEmailModel = userEmailModels.get(i);
            listBuilder.add(new UserInfo(userModel.id, userModel.jid, userModel.username, userModel.name, userEmailModel.email, getAvatarImageUrl(userModel.profilePictureImageName), Arrays.asList(userModel.roles.split(","))));
        }
    }

    return new Page<>(listBuilder.build(), totalRow, pageIndex, pageSize);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:34,代码来源:UserServiceImpl.java

示例13: pageUnverifiedUsers

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Override
public Page<UserInfo> pageUnverifiedUsers(long pageIndex, long pageSize, String orderBy, String orderDir, String filterString) {
    List<String> unverifiedEmailUserJids = userEmailDao.findUserJidsWithUnverifiedEmail();
    List<String> userUserJids = userDao.findUserJidsByFilter(filterString);
    List<String> emailUserJids = userEmailDao.findUserJidsByFilter(filterString);

    userUserJids.retainAll(unverifiedEmailUserJids);
    emailUserJids.retainAll(unverifiedEmailUserJids);

    ImmutableSet.Builder<String> setBuilder = ImmutableSet.builder();
    setBuilder.addAll(userUserJids);
    setBuilder.addAll(emailUserJids);

    ImmutableSet<String> userJidSet = setBuilder.build();
    long totalRow = userJidSet.size();
    ImmutableList.Builder<UserInfo> listBuilder = ImmutableList.builder();

    if (totalRow > 0) {
        List<String> sortedUserJid;
        if (orderBy.equals("email")) {
            sortedUserJid = userEmailDao.sortUserJidsByEmail(userJidSet, orderBy, orderDir);
        } else {
            sortedUserJid = userDao.sortUserJidsByUserAttribute(userJidSet, orderBy, orderDir);
        }

        List<UserModel> userModels = userDao.findBySetOfUserJids(sortedUserJid, pageIndex * pageSize, pageSize);
        List<UserEmailModel> emailModels = userEmailDao.findBySetOfUserJids(sortedUserJid, pageIndex * pageSize, pageSize);

        for (int i = 0; i < userModels.size(); ++i) {
            UserModel userModel = userModels.get(i);
            UserEmailModel emailModel = emailModels.get(i);
            listBuilder.add(new UserInfo(userModel.id, userModel.jid, userModel.username, userModel.name, emailModel.email, getAvatarImageUrl(userModel.profilePictureImageName), Arrays.asList(userModel.roles.split(","))));
        }
    }

    return new Page<>(listBuilder.build(), totalRow, pageIndex, pageSize);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:38,代码来源:UserServiceImpl.java

示例14: pageUserActivities

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Override
public Page<UserActivity> pageUserActivities(long pageIndex, long pageSize, String orderBy, String orderDir, String filterString, Set<String> clientsNames, String username) {
    List<String> clientJids = clientDao.findClientJidsByNames(clientsNames);
    String userJid = userDao.findByUsername(username).jid;

    ImmutableMap.Builder<SingularAttribute<? super UserActivityModel, String>, List<String>> inBuilder = ImmutableMap.builder();
    if (!clientJids.isEmpty()) {
        inBuilder.put(UserActivityModel_.clientJid, clientJids);
    }

    long totalRow = userActivityDao.countByFilters(filterString, ImmutableMap.of(UserModel_.userCreate, userJid), inBuilder.build());
    List<UserActivityModel> userActivityModels = userActivityDao.findSortedByFilters(orderBy, orderDir, filterString, ImmutableMap.of(UserModel_.userCreate, userJid), inBuilder.build(), pageIndex * pageSize, pageSize);

    Map<String, String> clientNameMap = Maps.newHashMap();

    ImmutableList.Builder<UserActivity> userActivityBuilder = ImmutableList.builder();
    for (UserActivityModel userActivityModel : userActivityModels) {
        if (!clientNameMap.containsKey(userActivityModel.clientJid)) {
            if (clientDao.existsByJid(userActivityModel.clientJid)) {
                ClientModel clientModel = clientDao.findByJid(userActivityModel.clientJid);
                clientNameMap.put(clientModel.jid, clientModel.name);
            } else {
                clientNameMap.put(userActivityModel.clientJid, userActivityModel.clientJid);
            }
        }
        String clientName = clientNameMap.get(userActivityModel.clientJid);

        userActivityBuilder.add(createUserActivityFromModel(userActivityModel, username, clientName));
    }

    return new Page<>(userActivityBuilder.build(), totalRow, pageIndex, pageSize);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:33,代码来源:UserActivityServiceImpl.java

示例15: pageClients

import org.iatoki.judgels.play.Page; //导入依赖的package包/类
@Override
public Page<Client> pageClients(long pageIndex, long pageSize, String orderBy, String orderDir, String filterString) {
    long totalPages = clientDao.countByFilters(filterString, ImmutableMap.of(), ImmutableMap.of());
    List<ClientModel> clientModels = clientDao.findSortedByFilters(orderBy, orderDir, filterString, ImmutableMap.of(), ImmutableMap.of(), pageIndex * pageSize, pageSize);

    List<Client> clients = Lists.transform(clientModels, m -> createClientFromModel(m, ImmutableSet.copyOf(m.scopes.split(",")), ImmutableList.of()));

    return new Page<>(clients, totalPages, pageIndex, pageSize);
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:10,代码来源:ClientServiceImpl.java


注:本文中的org.iatoki.judgels.play.Page类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。