1 53 54 package com.Yasna.forum; 55 56 import java.util.Date ; 57 import java.util.Iterator ; 58 import java.util.Enumeration ; 59 60 71 public class ForumGroupProxy implements ForumGroup { 72 73 private ForumGroup forumGroup; 74 private Authorization authorization; 75 private ForumPermissions permissions; 76 77 84 public ForumGroupProxy(ForumGroup forumGroup, Authorization authorization, 85 ForumPermissions permissions) 86 { 87 this.forumGroup = forumGroup; 88 this.authorization = authorization; 89 this.permissions = permissions; 90 } 91 92 public String getName() { 94 return forumGroup.getName(); 95 } 96 97 public int getID() { 98 return forumGroup.getID(); 99 } 100 101 public String getDescription() { 102 return forumGroup.getDescription(); 103 } 104 105 public Date getCreationDate() { 106 return forumGroup.getCreationDate(); 107 } 108 109 public Date getModifiedDate() { 110 return forumGroup.getModifiedDate(); 111 } 112 public int getOrder(){ 113 return forumGroup.getOrder(); 114 } 115 public void setOrder(int param) throws UnauthorizedException{ 116 if (permissions.isSystemOrForumAdmin()) { 117 forumGroup.setOrder(param); 118 } 119 else { 120 throw new UnauthorizedException(); 121 } 122 } 123 public void setModifiedDate(Date modifiedDate) throws UnauthorizedException { 124 if (permissions.isSystemOrForumAdmin()) { 125 forumGroup.setModifiedDate(modifiedDate); 126 } 127 else { 128 throw new UnauthorizedException(); 129 } 130 } 131 132 public void setCreationDate(Date creationDate) throws UnauthorizedException { 133 if (permissions.isSystemOrForumAdmin()) { 134 forumGroup.setCreationDate(creationDate); 135 } 136 else { 137 throw new UnauthorizedException(); 138 } 139 } 140 141 public void setName(String name) throws UnauthorizedException { 142 if (permissions.isSystemOrForumAdmin()) { 143 forumGroup.setName(name); 144 } 145 else { 146 throw new UnauthorizedException(); 147 } 148 } 149 150 public void setDescription(String description) throws UnauthorizedException { 151 if (permissions.isSystemOrForumAdmin()) { 152 forumGroup.setDescription(description); 153 } 154 else { 155 throw new UnauthorizedException(); 156 } 157 } 158 159 public Iterator forums() { 160 Iterator iterator = forumGroup.forums(); 161 return new ForumIteratorProxy(iterator, authorization, permissions,false); 162 } 163 } 164 | Popular Tags |