1 package com.mvnforum.jaxb.dao; 2 3 import java.util.Collection ; 4 import java.util.Iterator ; 5 6 import javax.xml.bind.JAXBException; 7 8 import com.mvnforum.jaxb.db.AttachmentList; 9 import com.mvnforum.jaxb.db.AttachmentType; 10 import com.mvnforum.jaxb.db.CategoryListType; 11 import com.mvnforum.jaxb.db.CategoryType; 12 import com.mvnforum.jaxb.db.CategoryWatchList; 13 import com.mvnforum.jaxb.db.FavoriteThreadList; 14 import com.mvnforum.jaxb.db.FavoriteThreadType; 15 import com.mvnforum.jaxb.db.ForumList; 16 import com.mvnforum.jaxb.db.ForumType; 17 import com.mvnforum.jaxb.db.ForumWatchList; 18 import com.mvnforum.jaxb.db.GroupForumPermissionList; 19 import com.mvnforum.jaxb.db.GroupForumPermissionType; 20 import com.mvnforum.jaxb.db.MemberForumPermissionList; 21 import com.mvnforum.jaxb.db.MemberForumPermissionType; 22 import com.mvnforum.jaxb.db.ObjectFactory; 23 import com.mvnforum.jaxb.db.PostList; 24 import com.mvnforum.jaxb.db.PostType; 25 import com.mvnforum.jaxb.db.ThreadList; 26 import com.mvnforum.jaxb.db.ThreadType; 27 import com.mvnforum.jaxb.db.ThreadWatchList; 28 import com.mvnforum.jaxb.db.ThreadWatchType; 29 import com.mvnforum.jaxb.util.XMLUtil; 30 31 public class CategoryListDAO { 32 33 public AttachmentType getAttachmentType(String memberName, String attachFilename, int attachFileSize, String attachMimeType, 34 String attachDesc, String attachCreationIP, String attachCreationDate, String attachModifiedDate, int attachDownloadCount, 35 int attachOption, int attachStatus) throws JAXBException { 36 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 37 AttachmentType attachmentType = objectFactory.createAttachmentType(); 38 attachmentType.setMemberName(memberName); 39 attachmentType.setAttachFilename(attachFilename); 40 attachmentType.setAttachFileSize(attachFileSize); 41 attachmentType.setAttachMimeType(attachMimeType); 42 attachmentType.setAttachDesc(attachDesc); 43 attachmentType.setAttachCreationIP(attachCreationIP); 44 attachmentType.setAttachCreationDate(attachCreationDate); 45 attachmentType.setAttachModifiedDate(attachModifiedDate); 46 attachmentType.setAttachDownloadCount(attachDownloadCount); 47 attachmentType.setAttachOption(attachOption); 48 attachmentType.setAttachStatus(attachStatus); 49 50 return attachmentType; 51 } 52 53 public AttachmentList getAttachmentList (Collection attachmentLists) throws JAXBException { 54 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 55 AttachmentList attachmentList = objectFactory.createAttachmentList(); 56 for (Iterator iter = attachmentLists.iterator(); iter.hasNext(); ) { 57 attachmentList.getAttachment().add(iter.next()); 58 } 59 return attachmentList; 60 } 61 62 public PostType getPostType (String memberName, String lastEditMemberName, String postTopic, String postBody, String postCreationDate, 63 String postLastEditDate, String postCreationIP, String postLastEditIP, int postEditCount, int postFormatOption, 64 int postOption, int postStatus, String postIcon, int postAttachCount, AttachmentList attachmentList, PostList postList) throws JAXBException { 65 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 66 PostType postType = objectFactory.createPostType(); 67 68 postType.setMemberName(memberName); 69 postType.setLastEditMemberName(lastEditMemberName); 70 postType.setPostTopic(postTopic); 71 postType.setPostBody(postBody); 72 postType.setPostCreationDate(postCreationDate); 73 postType.setPostLastEditDate(postLastEditDate); 74 postType.setPostCreationIP(postCreationIP); 75 postType.setPostLastEditIP(postLastEditIP); 76 postType.setPostEditCount(postEditCount); 77 postType.setPostFormatOption(postFormatOption); 78 postType.setPostOption(postOption); 79 postType.setPostStatus(postStatus); 80 postType.setPostIcon(postIcon); 81 postType.setPostAttachCount(postAttachCount); 82 postType.setAttachmentList(attachmentList); 83 postType.setPostList(postList); 84 85 return postType; 86 } 87 88 public PostList getPostList (Collection postLists) throws JAXBException { 89 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 90 PostList postList = objectFactory.createPostList(); 91 for (Iterator iter = postLists.iterator(); iter.hasNext(); ) { 92 postList.getPost().add(iter.next()); 93 } 94 return postList; 95 } 96 97 public PostList getPortList () throws JAXBException { 98 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 99 PostList postList = objectFactory.createPostList(); 100 return postList; 101 } 102 103 public FavoriteThreadType getFavoriteThreadType(String memberName, String favoriteCreationDate, int favoriteType, int favoriteOption, int favoriteStatus) throws JAXBException { 104 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 105 FavoriteThreadType rank = objectFactory.createFavoriteThreadType(); 106 rank.setMemberName(memberName); 107 rank.setFavoriteCreationDate(favoriteCreationDate); 108 rank.setFavoriteType(favoriteType); 109 rank.setFavoriteOption(favoriteOption); 110 rank.setFavoriteStatus(favoriteStatus); 111 return rank; 112 } 113 114 public FavoriteThreadList getFavoriteThreadList(Collection favoriteThreadType) throws JAXBException { 115 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 116 FavoriteThreadList favoriteThreadList = objectFactory.createFavoriteThreadList(); 117 for (Iterator iter = favoriteThreadType.iterator(); iter.hasNext(); ) { 118 favoriteThreadList.getFavoriteThread().add(iter.next()); 119 } 120 return favoriteThreadList; 121 } 122 123 public ThreadWatchType getThreadWatchType(String memberName, int watchType, int watchOption, int watchStatus, String watchCreationDate, 124 String watchLastSentDate, String watchEndDate) throws JAXBException { 125 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 126 ThreadWatchType threadWatchType = objectFactory.createThreadWatchType(); 127 threadWatchType.setMemberName(memberName); 128 threadWatchType.setWatchType(watchType); 129 threadWatchType.setWatchOption(watchOption); 130 threadWatchType.setWatchStatus(watchStatus); 131 threadWatchType.setWatchCreationDate(watchCreationDate); 132 threadWatchType.setWatchLastSentDate(watchLastSentDate); 133 threadWatchType.setWatchEndDate(watchEndDate); 134 return threadWatchType; 135 } 136 137 public ThreadWatchList getThreadWatchList(Collection threadWatchType) throws JAXBException { 138 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 139 ThreadWatchList threadWatchList = objectFactory.createThreadWatchList(); 140 for (Iterator iter = threadWatchType.iterator(); iter.hasNext(); ) { 141 threadWatchList.getThreadWatch().add(iter.next()); 142 } 143 return threadWatchList; 144 } 145 146 public ThreadType getThreadType(String memberName, String threadLastPostMemberName, String threadTopic, String threadBody, 147 int threadVoteCount, int threadVoteTotalStars, String threadCreationDate, String threadLastPostDate, int threadType, 148 int threadOption, int threadStatus, int threadHasPoll, int threadViewCount, int threadReplyCount, String threadIcon, 149 int threadDuration, ThreadWatchList threadWatchList, FavoriteThreadList favoriteThreadList, PostList postList) throws JAXBException { 150 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 151 ThreadType bean = objectFactory.createThreadType(); 152 bean.setMemberName(memberName); 153 bean.setThreadLastPostMemberName(threadLastPostMemberName); 154 bean.setThreadTopic(threadTopic); 155 bean.setThreadBody(threadBody); 156 bean.setThreadVoteCount(threadVoteCount); 157 bean.setThreadVoteTotalStars(threadVoteTotalStars); 158 bean.setThreadCreationDate(threadCreationDate); 159 bean.setThreadLastPostDate(threadLastPostDate); 160 bean.setThreadType(threadType); 161 bean.setThreadOption(threadOption); 162 bean.setThreadStatus(threadStatus); 163 bean.setThreadHasPoll(threadHasPoll); 164 bean.setThreadViewCount(threadViewCount); 165 bean.setThreadReplyCount(threadReplyCount); 166 bean.setThreadIcon(threadIcon); 167 bean.setThreadDuration(threadDuration); 168 bean.setThreadWatchList(threadWatchList); 169 bean.setFavoriteThreadList(favoriteThreadList); 170 bean.setPostList(postList); 171 return bean; 172 } 173 174 public ThreadList getThreadList(Collection threadType) throws JAXBException { 175 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 176 ThreadList threadList = objectFactory.createThreadList(); 177 for (Iterator iter = threadType.iterator(); iter.hasNext(); ) { 178 threadList.getThread().add(iter.next()); 179 } 180 return threadList; 181 } 182 183 public ForumWatchList getForumWatchList(Collection forumWatchLists) throws JAXBException { 184 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 185 ForumWatchList forumWatchList = objectFactory.createForumWatchList(); 186 for (Iterator iter = forumWatchLists.iterator(); iter.hasNext(); ) { 187 forumWatchList.getForumWatchList().add(iter.next()); 188 } 189 return forumWatchList; 190 } 191 192 public GroupForumPermissionType getGroupForumPermissionType(String groupName, int forumPermission) throws JAXBException { 193 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 194 GroupForumPermissionType groupForumPermissionType = objectFactory.createGroupForumPermissionType(); 195 groupForumPermissionType.setGroupName(groupName); 196 groupForumPermissionType.setForumPermission(forumPermission); 197 return groupForumPermissionType; 198 } 199 200 public GroupForumPermissionList getGroupForumPermissionList(Collection groupForumPermissionTypes) throws JAXBException { 201 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 202 GroupForumPermissionList groupForumPermissionList = objectFactory.createGroupForumPermissionList(); 203 for (Iterator iter = groupForumPermissionTypes.iterator(); iter.hasNext(); ) { 204 groupForumPermissionList.getGroupForumPermission().add(iter.next()); 205 } 206 return groupForumPermissionList; 207 } 208 209 public MemberForumPermissionType getMemberForumPermissionType(String memberName, int forumPermission) throws JAXBException { 210 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 211 MemberForumPermissionType memberForumPermissionType = objectFactory.createMemberForumPermissionType(); 212 memberForumPermissionType.setMemberName(memberName); 213 memberForumPermissionType.setForumPermission(forumPermission); 214 return memberForumPermissionType; 215 } 216 217 public MemberForumPermissionList getMemberForumPermissionList(Collection memberForumPermissionTypes) throws JAXBException { 218 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 219 MemberForumPermissionList memberForumPermissionList = objectFactory.createMemberForumPermissionList(); 220 for (Iterator iter = memberForumPermissionTypes.iterator(); iter.hasNext(); ) { 221 memberForumPermissionList.getMemberForumPermission().add(iter.next()); 222 } 223 return memberForumPermissionList; 224 } 225 226 public ForumType getForumType(String forumLastPostMemberName, String forumName, String forumDesc, String forumCreationDate, String forumModifiedDate, 227 String forumLastPostDate, int forumOrder, int forumFormatOption, int forumOption, int forumStatus, int forumModerationMode, 228 String forumPassword, int forumThreadCount, int forumPostCount, MemberForumPermissionList memberForumPermissionList, 229 GroupForumPermissionList groupForumPermissionList, ForumWatchList forumWatchList, ThreadList threadList) throws JAXBException { 230 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 231 ForumType forumType = objectFactory.createForumType(); 232 forumType.setForumLastPostMemberName(forumLastPostMemberName); 233 forumType.setForumName(forumName); 234 forumType.setForumDesc(forumDesc); 235 forumType.setForumCreationDate(forumCreationDate); 236 forumType.setForumModifiedDate(forumModifiedDate); 237 forumType.setForumLastPostDate(forumLastPostDate); 238 forumType.setForumOrder(forumOrder); 239 forumType.setForumFormatOption(forumFormatOption); 240 forumType.setForumOption(forumOption); 241 forumType.setForumStatus(forumStatus); 242 forumType.setForumModerationMode(forumModerationMode); 243 forumType.setForumPassword(forumPassword); 244 forumType.setForumThreadCount(forumThreadCount); 245 forumType.setForumPostCount(forumPostCount); 246 forumType.setMemberForumPermissionList(memberForumPermissionList); 247 forumType.setGroupForumPermissionList(groupForumPermissionList); 248 forumType.setForumWatchList(forumWatchList); 249 forumType.setThreadList(threadList); 250 return forumType; 251 } 252 253 public ForumList getForumList(Collection forumType) throws JAXBException { 254 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 255 ForumList forumList = objectFactory.createForumList(); 256 for (Iterator iter = forumType.iterator(); iter.hasNext(); ) { 257 forumList.getForum().add(iter.next()); 258 } 259 return forumList; 260 } 261 262 public CategoryWatchList getCategoryWatchList(Collection categoryWatch) throws JAXBException { 263 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 264 CategoryWatchList categoryWatchList = objectFactory.createCategoryWatchList(); 265 for (Iterator iter = categoryWatch.iterator(); iter.hasNext(); ) { 266 categoryWatchList.getCategoryWatch().add(iter.next()); 267 } 268 return categoryWatchList; 269 } 270 271 public CategoryListType getCategoryListType(Collection categoryType) throws JAXBException { 272 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 273 CategoryListType categoryListType = objectFactory.createCategoryListType(); 274 for (Iterator iter = categoryType.iterator(); iter.hasNext(); ) { 275 categoryListType.getCategory().add(iter.next()); 276 } 277 return categoryListType; 278 } 279 280 public CategoryListType getCategoryListType () throws JAXBException { 281 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 282 CategoryListType categoryListType = objectFactory.createCategoryListType(); 283 return categoryListType; 284 } 285 286 public CategoryType getCategoryType(String categoryName, String categoryDesc, String categoryCreationDate, String categoryModifiedDate, 287 int categoryOrder, int categoryOption, int categoryStatus, CategoryWatchList categoryWatchList, ForumList forumList, CategoryListType categoryList) 288 throws JAXBException { 289 ObjectFactory objectFactory = XMLUtil.getObjectFactory(); 290 CategoryType rank = objectFactory.createCategoryType(); 291 rank.setCategoryName(categoryName); 292 rank.setCategoryDesc(categoryDesc); 293 rank.setCategoryCreationDate(categoryCreationDate); 294 rank.setCategoryModifiedDate(categoryModifiedDate); 295 rank.setCategoryOrder(categoryOrder); 296 rank.setCategoryOption(categoryOption); 297 rank.setCategoryStatus(categoryStatus); 298 rank.setCategoryWatchList(categoryWatchList); 299 rank.setForumList(forumList); 300 rank.setCategoryList(categoryList); 301 return rank; 302 } 303 304 305 306 307 308 309 310 } 311 | Popular Tags |