rewardmanagerproxy.java

来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· Java 代码 · 共 98 行

JAVA
98
字号
/** * $RCSfile: RewardManagerProxy.java,v $ * $Revision: 1.1 $ * $Date: 2002/02/27 18:51:21 $ * * Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved. * * This software is the proprietary information of CoolServlets, Inc. * Use is subject to license terms. */package com.jivesoftware.forum;import java.util.Iterator;/** * Protection proxy for RewardManager objects. */public class RewardManagerProxy implements RewardManager{    protected RewardManager rewardManager;    protected Authorization authorization;    protected ForumPermissions permissions;    public RewardManagerProxy(RewardManager rewardManager,            Authorization authorization, ForumPermissions permissions)    {        this.rewardManager = rewardManager;        this.authorization = authorization;        this.permissions = permissions;    }    public int getMaxPoints() {        return rewardManager.getMaxPoints();    }    public void setMaxPoints(int numPoints) throws UnauthorizedException    {        if (permissions.get(ForumPermissions.SYSTEM_ADMIN)) {            rewardManager.setMaxPoints(numPoints);        }    }    public void transferPoints(ForumThread thread, int numPoints)            throws UnauthorizedException, RewardException    {        User user = thread.getRootMessage().getUser();        if ( permissions.get(ForumPermissions.SYSTEM_ADMIN) ||            (user != null && user.getID() == authorization.getUserID()) )        {            rewardManager.transferPoints(thread, numPoints);        }    }    public void rewardPoints(ForumMessage message, int numPoints)            throws UnauthorizedException, RewardException    {        User user = message.getForumThread().getRootMessage().getUser();        if ( permissions.get(ForumPermissions.SYSTEM_ADMIN) ||            (user != null && user.getID() == authorization.getUserID()) )        {            rewardManager.rewardPoints(message, numPoints);        }    }    public int getPoints(ForumThread thread) {        return rewardManager.getPoints(thread);    }    public int getPoints(ForumMessage message) {        return rewardManager.getPoints(message);    }    public int getCurrentPoints(User user) {        return rewardManager.getCurrentPoints(user);    }    public Iterator userRewardThreads(User user) {        return new IteratorProxy(JiveGlobals.THREAD,                rewardManager.userRewardThreads(user), authorization, permissions);    }    public int getTotalPointsRewarded(User user) {        return rewardManager.getTotalPointsRewarded(user);    }    public int getTotalPointsEarned(User user) {        return rewardManager.getTotalPointsEarned(user);    }    public void addPoints(User user, int numPoints)            throws UnauthorizedException, RewardException    {        if (permissions.get(ForumPermissions.SYSTEM_ADMIN)) {            rewardManager.addPoints(user, numPoints);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?