001: //The contents of this file are subject to the Mozilla Public License Version 1.1
002: //(the "License"); you may not use this file except in compliance with the
003: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
004: //
005: //Software distributed under the License is distributed on an "AS IS" basis,
006: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
007: //for the specific language governing rights and
008: //limitations under the License.
009: //
010: //The Original Code is "The Columba Project"
011: //
012: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
013: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
014: //
015: //All Rights Reserved.
016: package org.columba.mail.command;
017:
018: import java.io.File;
019: import java.lang.reflect.Array;
020:
021: import org.columba.core.folder.DefaultFolderCommandReference;
022: import org.columba.core.folder.api.IFolder;
023: import org.columba.mail.folder.IMailFolder;
024: import org.columba.mail.message.IColumbaMessage;
025:
026: /**
027: * This is a reference implemention suitable for folders containing messages.
028: * <p>
029: * Its main purpose is to store source and/or destination folders and arrays of
030: * message UIDs.
031: * <p>
032: *
033: *
034: * @author fdietz
035: */
036: public class MailFolderCommandReference extends
037: DefaultFolderCommandReference implements
038: IMailFolderCommandReference {
039: private Integer[] address;
040:
041: private IColumbaMessage message;
042:
043: private int markVariant;
044:
045: private String folderName;
046:
047: private String folderType;
048:
049: private int colorValue;
050:
051: private File destFile;
052:
053: /**
054: * Constructor for MailFolderCommandReference.
055: *
056: * @param folder
057: */
058: public MailFolderCommandReference(IFolder folder) {
059: super (folder);
060: }
061:
062: public MailFolderCommandReference(IFolder folder,
063: IFolder destinationFolder) {
064: super (folder, destinationFolder);
065: }
066:
067: public MailFolderCommandReference(IFolder folder,
068: IColumbaMessage message) {
069: super (folder);
070:
071: this .message = message;
072: }
073:
074: /**
075: * Constructor for MailFolderCommandReference.
076: *
077: * @param folder
078: * @param uids
079: */
080: public MailFolderCommandReference(IFolder folder, Object[] uids) {
081: super (folder, uids);
082:
083: }
084:
085: /**
086: * Constructor for MailFolderCommandReference.
087: *
088: * @param sourceFolder
089: * @param destinationFolder
090: * @param uids
091: */
092: public MailFolderCommandReference(IFolder sourceFolder,
093: IMailFolder destinationFolder, Object[] uids) {
094: super (sourceFolder, destinationFolder, uids);
095: }
096:
097: /**
098: * Constructor for MailFolderCommandReference.
099: *
100: * @param folder
101: * @param uids
102: * @param address
103: */
104: public MailFolderCommandReference(IFolder folder, Object[] uids,
105: Integer[] address) {
106: super (folder, uids);
107:
108: this .address = address;
109: }
110:
111: public Integer[] getAddress() {
112: return address;
113: }
114:
115: public void setAddress(Integer[] address) {
116: this .address = address;
117: }
118:
119: public IColumbaMessage getMessage() {
120: return message;
121: }
122:
123: public void setMessage(IColumbaMessage message) {
124: this .message = message;
125: }
126:
127: public void reduceToFirstUid() {
128: Object[] uids = getUids();
129:
130: if (uids == null) {
131: return;
132: }
133:
134: int size = Array.getLength(uids);
135:
136: if (size > 1) {
137: Object[] oneUid = new Object[1];
138: oneUid[0] = uids[0];
139: uids = oneUid;
140: }
141: }
142:
143: /**
144: * Returns the markVariant.
145: *
146: * @return int
147: */
148: public int getMarkVariant() {
149: return markVariant;
150: }
151:
152: /**
153: * Sets the markVariant.
154: *
155: * @param markVariant
156: * The markVariant to set
157: */
158: public void setMarkVariant(int markVariant) {
159: this .markVariant = markVariant;
160: }
161:
162: /**
163: * Returns the folderName.
164: *
165: * @return String
166: */
167: public String getFolderName() {
168: return folderName;
169: }
170:
171: /**
172: * Sets the folderName.
173: *
174: * @param folderName
175: * The folderName to set
176: */
177: public void setFolderName(String folderName) {
178: this .folderName = folderName;
179: }
180:
181: /**
182: * @return destFile
183: */
184: public File getDestFile() {
185: return destFile;
186: }
187:
188: /**
189: * @param destFile
190: */
191: public void setDestFile(File destFile) {
192: this .destFile = destFile;
193: }
194:
195: /**
196: * @return Returns the colorValue.
197: */
198: public int getColorValue() {
199: return colorValue;
200: }
201:
202: /**
203: * @param colorValue
204: * The colorValue to set.
205: */
206: public void setColorValue(int colorValue) {
207: this .colorValue = colorValue;
208: }
209:
210: /**
211: * @return Returns the folderType.
212: */
213: public String getFolderType() {
214: return folderType;
215: }
216:
217: /**
218: * @param folderType
219: * The folderType to set.
220: */
221: public void setFolderType(String folderType) {
222: this.folderType = folderType;
223: }
224:
225: }
|