001: /***
002: * jwma Java WebMail
003: * Copyright (c) 2000-2003 jwma team
004: *
005: * jwma is free software; you can distribute and use this source
006: * under the terms of the BSD-style license received along with
007: * the distribution.
008: ***/package dtw.webmail.model;
009:
010: import dtw.webmail.util.ContactFilter;
011:
012: import java.util.Collection;
013: import java.util.Iterator;
014:
015: /**
016: * Interface for <tt>JwmaContacts</tt> implementations.
017: * This is the interface any specialized implementation
018: * has to expose internal to controllers and models.
019: *
020: * @author Dieter Wimberger
021: * @version 0.9.7 07/02/2003
022: */
023: public interface JwmaContactsImpl extends JwmaContacts {
024:
025: /**
026: * Tests if this <tt>JwmaContactsImpl</tt> contains a
027: * contact with the given unique identifier.
028: *
029: * @param uid a unique identifier of a contact.
030: *
031: * @return true if contained, false otherwise.
032: */
033: public boolean containsContact(String uid);
034:
035: /**
036: * Returns contact with given nickname.
037: *
038: * @param nick the nickname as <tt>String</tt>.
039: *
040: * @return the contact.
041: */
042: public JwmaContact getContactByNickname(String nick);
043:
044: /**
045: * Tests if the contact database contains a
046: * contact with the given nickname.
047: *
048: * @param nick the nickname as <tt>String</tt>.
049: *
050: * @return true if contained, false otherwise.
051: */
052: public boolean containsContactWithNickname(String nick);
053:
054: /**
055: * Adds a <tt>JwmaContactImpl</tt> instance to this
056: * contact database.
057: *
058: * @param contact the <tt>JwmaContactImpl</tt> to be added.
059: */
060: public void addContact(JwmaContactImpl contact);
061:
062: /**
063: * Removes a <tt>JwmaContactImpl</tt> instance from this
064: * contact database.
065: *
066: * @param contact the <tt>JwmaContactImpl</tt> to be removed.
067: */
068: public void removeContact(JwmaContactImpl contact);
069:
070: /**
071: * Adds a frequent recipient <tt>JwmaContactImpl</tt>
072: * instance to this contact database.
073: *
074: * @param contact the frequent recipient <tt>JwmaContactImpl</tt>
075: * to be added.
076: */
077: public void addFrequentRecipient(JwmaContactImpl contact);
078:
079: /**
080: * Removes a frequent recipient <tt>JwmaContactImpl</tt>
081: * instance from this contact database.
082: *
083: * @param contact the frequent recipient <tt>JwmaContactImpl</tt>
084: * to be removed.
085: */
086: public void removeFrequentRecipient(JwmaContactImpl contact);
087:
088: /**
089: * Tests if a given category exists in this <tt>JwmaContactsImpl</tt>.
090: *
091: * @param category a category to be looked up.
092: *
093: * @return true if the category exists, false otherwise.
094: */
095: public boolean existsContactCategory(String category);
096:
097: /**
098: * Adds a contact category to the cached list of
099: * categories.
100: * <p>
101: * If the category already exists, the method returns
102: * immediately.
103: *
104: * @param category the category as <tt>String</tt>.
105: */
106: public void addContactCategory(String category);
107:
108: /**
109: * Tests if this <tt>JwmaContactsImpl</tt> contains a
110: * contact group with the given unique identifier.
111: *
112: * @param uid a unique identifier of a contact group.
113: *
114: * @return true if contained, false otherwise.
115: */
116: public boolean containsContactGroup(String uid);
117:
118: /**
119: * Tests if this <tt>JwmaContactsImpl</tt> contains a
120: * contact group with the given name.
121: *
122: * @param name the name for a contact group.
123: *
124: * @return true if contained, false otherwise.
125: */
126: public boolean containsContactGroupName(String name);
127:
128: /**
129: * Returns an <tt>JwmaContactGroupByName</tt> representing the
130: * contact group with the given name.
131: * <p>
132: * If the contact database does not contain any contact group with
133: * the given name, it returns null. Otherwise it returns
134: * the associated contact group.
135: *
136: * @return the contact group associated with the given name,
137: * or null.
138: */
139: public JwmaContactGroup getContactGroupByName(String name);
140:
141: /**
142: * Adds a <tt>JwmaContactGroupImpl</tt> instance to this
143: * contact database.
144: *
145: * @param contact the <tt>JwmaContactGroupImpl</tt> to be added.
146: */
147: public void addContactGroup(JwmaContactGroupImpl group);
148:
149: /**
150: * Removes a <tt>JwmaContactGroupImpl</tt> instance from this
151: * contact database.
152: *
153: * @param contact the <tt>JwmaContactGroupImpl</tt> to be removed.
154: */
155: public void removeContactGroup(JwmaContactGroupImpl group);
156:
157: /**
158: * Creates a new <tt>JwmaContactGroupImpl</tt> with the given
159: * name.
160: *
161: * @param name the name of the new group as <tt>String</tt>.
162: *
163: * @return the newly created <tt>JwmaContactGroupImpl</tt> instance.
164: *
165: * @throws JwmaException if a group with the same name exists already.
166: */
167: public JwmaContactGroupImpl createContactGroup(String name)
168: throws JwmaException;
169:
170: /**
171: * Creates and returns a new <tt>JwmaContactImpl</tt>.
172: *
173: *
174: * @return the newly created <tt>JwmaContactImpl</tt> instance.
175: *
176: */
177: public JwmaContactImpl createContact();
178:
179: /**
180: * Sets an arbitrary contact filter, which will be
181: * filtering contacts on listing.
182: * Note that this filter is independent from the
183: * category filter, filtering proceeds additive
184: * (i.e. a contact has to pass both, AND).
185: *
186: * @param filter an arbitrary <tt>ContactFilter</tt>.
187: */
188: public void setContactFilter(ContactFilter filter);
189:
190: /**
191: * Returns the arbitrary contact filter, which is
192: * set for filtering contacts on listing.
193: *
194: * @return the contact filter instance.
195: */
196: public ContactFilter getContactFilter();
197:
198: /**
199: * Returns an iterator of non-duplicate strings
200: * with the first characters of the lastnames of
201: * all contacts in this contact database.
202: */
203: public Iterator getLastnameStarts();
204:
205: /**
206: * Sets a category based contact filter, which
207: * will be filtering contacts which are not
208: * of the given category on listing.
209: * Note that this filter is independent from the
210: * arbitrary set filter, filtering proceeds
211: * additive (i.e. a contact has to pass both, AND).
212: *
213: * @param category the category which should be listed .
214: */
215: public void setCategoryFilter(String category);
216:
217: /**
218: * Returns the name of the category which is not
219: * filtered at the moment.
220: *
221: * @return the category name which is not filtered as <tt>String</tt>.
222: */
223: public String getCategoryFilter();
224:
225: }//JwmaContacts
|