001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/DiscussionAreaBean.java $
003: * $Id: DiscussionAreaBean.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006, 2007 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.messageforums.ui;
021:
022: import org.apache.commons.logging.Log;
023: import org.apache.commons.logging.LogFactory;
024:
025: import org.sakaiproject.api.app.messageforums.Area;
026:
027: /**
028: *
029: * @author <a href="mailto:wagnermr@iupui.edu">Michelle Wagner</a>
030: *
031: */
032: public class DiscussionAreaBean {
033: private static final Log LOG = LogFactory
034: .getLog(DiscussionAreaBean.class);
035:
036: private Area area;
037: private int numPendingMsgs;
038:
039: public DiscussionAreaBean(Area area) {
040: if (LOG.isDebugEnabled()) {
041: LOG
042: .debug("DiscussionAreaBean(DiscussionArea " + area
043: + ")");
044: }
045:
046: this .area = area;
047: }
048:
049: /**
050: * Returns whether the forum is moderated or not
051: * @return
052: */
053: public String getModerated() {
054: LOG.debug("getModerated()");
055: if (area == null || area.getModerated() == null
056: || area.getModerated().booleanValue() == false) {
057: return Boolean.FALSE.toString();
058: }
059:
060: return Boolean.TRUE.toString();
061: }
062:
063: /**
064: * Set the "moderated" setting for the forum
065: * @param moderated
066: */
067: public void setModerated(String moderated) {
068: LOG.debug("setModerated()");
069: if (moderated.equals(Boolean.TRUE.toString())) {
070: area.setModerated(new Boolean(true));
071: } else {
072: area.setModerated(new Boolean(false));
073: }
074: }
075:
076: /**
077: *
078: * @return
079: */
080: public Area getArea() {
081: return area;
082: }
083:
084: /**
085: * returns boolean moderated status for area
086: * @return
087: */
088: public boolean isAreaModerated() {
089: return area.getModerated().booleanValue();
090: }
091:
092: /**
093: * Returns number of msgs pending in moderated topics in which
094: * user has moderate perm
095: * @return
096: */
097: public int getNumPendingMsgs() {
098: return numPendingMsgs;
099: }
100:
101: /**
102: * Set num of pending msgs in area
103: *
104: */
105: public void setNumPendingMsgs(int numPendingMsgs) {
106: this.numPendingMsgs = numPendingMsgs;
107: }
108: }
|