001: package com.mvnforum.jaxb.dao;
002:
003: import java.util.Collection;
004: import java.util.Iterator;
005: import java.util.List;
006:
007: import javax.xml.bind.JAXBException;
008:
009: import com.mvnforum.jaxb.db.GlobalPermissionList;
010: import com.mvnforum.jaxb.db.GlobalWatchList;
011: import com.mvnforum.jaxb.db.GlobalWatchType;
012: import com.mvnforum.jaxb.db.MemberType;
013: import com.mvnforum.jaxb.db.MessageFolderList;
014: import com.mvnforum.jaxb.db.MessageFolderType;
015: import com.mvnforum.jaxb.db.MessageList;
016: import com.mvnforum.jaxb.db.MessageType;
017: import com.mvnforum.jaxb.db.Mvnforum;
018: import com.mvnforum.jaxb.db.ObjectFactory;
019: import com.mvnforum.jaxb.db.MvnforumType.MemberListType;
020: import com.mvnforum.jaxb.util.XMLUtil;
021:
022: public class MemberListDAO {
023:
024: public GlobalWatchType getGlobalWatchType(int watchType,
025: int watchOption, int watchStatus, String watchCreationDate,
026: String watchLastSentDate, String watchEndDate)
027: throws JAXBException {
028: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
029: GlobalWatchType globalWatchType = objectFactory
030: .createGlobalWatchType();
031: globalWatchType.setWatchType(watchType);
032: globalWatchType.setWatchOption(watchOption);
033: globalWatchType.setWatchStatus(watchStatus);
034: globalWatchType.setWatchCreationDate(watchCreationDate);
035: globalWatchType.setWatchLastSentDate(watchLastSentDate);
036: globalWatchType.setWatchEndDate(watchEndDate);
037: return globalWatchType;
038: }
039:
040: public GlobalWatchList getGlobalWatchList(Collection globalWatch)
041: throws JAXBException {
042: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
043: GlobalWatchList globalWatchList = objectFactory
044: .createGlobalWatchList();
045: for (Iterator iter = globalWatch.iterator(); iter.hasNext();) {
046: globalWatchList.getGlobalWatch().add(iter.next());
047: }
048: return globalWatchList;
049: }
050:
051: public MessageFolderType getMessageFolderType(String folderName,
052: int folderOrder, String folderCreationDate,
053: String folderModifiedDate, MessageList messageList)
054: throws JAXBException {
055: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
056: MessageFolderType messageFolderType = objectFactory
057: .createMessageFolderType();
058: messageFolderType.setFolderName(folderName);
059: messageFolderType.setFolderOrder(folderOrder);
060: messageFolderType.setFolderCreationDate(folderCreationDate);
061: messageFolderType.setFolderModifiedDate(folderModifiedDate);
062: messageFolderType.setMessageList(messageList);
063: return messageFolderType;
064: }
065:
066: public MessageFolderList getMessageFolderList(
067: Collection messageFolder) throws JAXBException {
068: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
069: MessageFolderList messageFolderList = objectFactory
070: .createMessageFolderList();
071: for (Iterator iter = messageFolder.iterator(); iter.hasNext();) {
072: messageFolderList.getMessageFolder().add(iter.next());
073: }
074: return messageFolderList;
075: }
076:
077: public GlobalPermissionList getGlobalPermissionList(
078: Collection globalPermission) throws JAXBException {
079: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
080: GlobalPermissionList globalPermissionList = objectFactory
081: .createGlobalPermissionList();
082: for (Iterator iter = globalPermission.iterator(); iter
083: .hasNext();) {
084: globalPermissionList.getGlobalPermission().add(iter.next());
085: }
086: return globalPermissionList;
087: }
088:
089: public MemberType getMemberList(String memberName,
090: String memberPassword, String memberFirstEmail,
091: String memberEmail, int memberEmailVisible,
092: int memberNameVisible, String memberFirstIP,
093: String memberLastIP, int memberViewCount,
094: int memberPostCount, String memberCreationDate,
095: String memberModifiedDate, String memberExpireDate,
096: String memberLastLogon, int memberOption, int memberStatus,
097: String memberActivateCode, String memberTempPassword,
098: int memberMessageCount, int memberMessageOption,
099: int memberPostsPerPage, int memberWarnCount,
100: int memberVoteCount, int memberVoteTotalStars,
101: int memberRewardPoints, String memberTitle,
102: double memberTimeZone, String memberSignature,
103: String memberAvatar, String memberSkin,
104: String memberLanguage, String memberFirstname,
105: String memberLastname, int memberGender,
106: String memberBirthday, String memberAddress,
107: String memberCity, String memberState,
108: String memberCountry, String memberPhone,
109: String memberMobile, String memberFax, String memberCareer,
110: String memberHomepage, String memberYahoo,
111: String memberAol, String memberIcq, String memberMsn,
112: String memberCoolLink1, String memberCoolLink2,
113: GlobalPermissionList globalPermissionList,
114: MessageFolderList messageFolderList,
115: GlobalWatchList globalWatchList) throws JAXBException {
116:
117: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
118: MemberType memberType = objectFactory.createMemberType();
119: memberType.setMemberName(memberName);
120: memberType.setMemberPassword(memberPassword);
121: memberType.setMemberFirstEmail(memberFirstEmail);
122: memberType.setMemberEmail(memberEmail);
123: memberType.setMemberEmailVisible(memberEmailVisible);
124: memberType.setMemberNameVisible(memberNameVisible);
125: memberType.setMemberFirstIP(memberFirstIP);
126: memberType.setMemberLastIP(memberLastIP);
127: memberType.setMemberViewCount(memberViewCount);
128: memberType.setMemberPostCount(memberPostCount);
129: memberType.setMemberCreationDate(memberCreationDate);
130: memberType.setMemberModifiedDate(memberModifiedDate);
131: memberType.setMemberExpireDate(memberExpireDate);
132: memberType.setMemberLastLogon(memberLastLogon);
133: memberType.setMemberOption(memberOption);
134: memberType.setMemberStatus(memberStatus);
135: memberType.setMemberActivateCode(memberActivateCode);
136: memberType.setMemberTempPassword(memberTempPassword);
137: memberType.setMemberMessageCount(memberMessageCount);
138: memberType.setMemberMessageOption(memberMessageOption);
139: memberType.setMemberPostsPerPage(memberPostsPerPage);
140: memberType.setMemberWarnCount(memberWarnCount);
141: memberType.setMemberVoteCount(memberVoteCount);
142: memberType.setMemberVoteTotalStars(memberVoteTotalStars);
143: memberType.setMemberRewardPoints(memberRewardPoints);
144: memberType.setMemberTitle(memberTitle);
145: memberType.setMemberTimeZone(memberTimeZone);
146: memberType.setMemberSignature(memberSignature);
147: memberType.setMemberAvatar(memberAvatar);
148: memberType.setMemberSkin(memberSkin);
149: memberType.setMemberLanguage(memberLanguage);
150: memberType.setMemberFirstname(memberFirstname);
151: memberType.setMemberLastname(memberLastname);
152: memberType.setMemberGender(memberGender);
153: memberType.setMemberBirthday(memberBirthday);
154: memberType.setMemberAddress(memberAddress);
155: memberType.setMemberCity(memberCity);
156: memberType.setMemberState(memberState);
157: memberType.setMemberCountry(memberCountry);
158: memberType.setMemberPhone(memberPhone);
159: memberType.setMemberMobile(memberMobile);
160: memberType.setMemberFax(memberFax);
161: memberType.setMemberCareer(memberCareer);
162: memberType.setMemberHomepage(memberHomepage);
163: memberType.setMemberYahoo(memberYahoo);
164: memberType.setMemberAol(memberAol);
165: memberType.setMemberIcq(memberIcq);
166: memberType.setMemberMsn(memberMsn);
167: memberType.setMemberCoolLink1(memberCoolLink1);
168: memberType.setMemberCoolLink2(memberCoolLink2);
169: memberType.setGlobalPermissionList(globalPermissionList);
170: memberType.setMessageFolderList(messageFolderList);
171: memberType.setGlobalWatchList(globalWatchList);
172: return memberType;
173: }
174:
175: public MemberListType getMemberListType(Collection memberTypes)
176: throws JAXBException {
177: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
178: MemberListType memberListType = objectFactory
179: .createMvnforumTypeMemberListType();
180: for (Iterator iter = memberTypes.iterator(); iter.hasNext();) {
181: memberListType.getMember().add(iter.next());
182: }
183: return memberListType;
184: }
185:
186: public MessageList getMessageList(Collection messageLists)
187: throws JAXBException {
188: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
189: MessageList messageList = objectFactory.createMessageList();
190: for (Iterator iter = messageLists.iterator(); iter.hasNext();) {
191: messageList.getMessage().add(iter.next());
192: }
193: return messageList;
194: }
195:
196: public MessageType getMessageType(String folderName,
197: String messageSenderName, String messageToList,
198: String messageCcList, String messageBccList,
199: String messageTopic, String messageBody, int messageType,
200: int messageOption, int messageStatus,
201: int messageReadStatus, int messageNotify,
202: String messageIcon, int messageAttachCount,
203: String messageIP, String messageCreationDate)
204: throws JAXBException {
205: ObjectFactory objectFactory = XMLUtil.getObjectFactory();
206: MessageType messageType2 = objectFactory.createMessageType();
207: messageType2.setFolderName(folderName);
208: messageType2.setMessageSenderName(messageSenderName);
209: messageType2.setMessageToList(messageToList);
210: messageType2.setMessageCcList(messageCcList);
211: messageType2.setMessageBccList(messageBccList);
212: messageType2.setMessageTopic(messageTopic);
213: messageType2.setMessageBody(messageBody);
214: messageType2.setMessageType(messageType);
215: messageType2.setMessageOption(messageOption);
216: messageType2.setMessageStatus(messageStatus);
217: messageType2.setMessageReadStatus(messageReadStatus);
218: messageType2.setMessageNotify(messageNotify);
219: messageType2.setMessageIcon(messageIcon);
220: messageType2.setMessageAttachCount(messageAttachCount);
221: messageType2.setMessageIP(messageIP);
222: messageType2.setMessageCreationDate(messageCreationDate);
223: return messageType2;
224: }
225:
226: public List importMemberList() throws JAXBException {
227:
228: Mvnforum mvnforum = XMLUtil.getMvnforum();
229: MemberListType memberListType = mvnforum.getMemberList();
230: return memberListType.getMember();
231:
232: }
233:
234: }
|