Jwma

dtw.webmail.plugin.std
Class CastorContacts

java.lang.Object
  |
  +--dtw.webmail.util.AbstractIdentifiable
        |
        +--dtw.webmail.plugin.std.CastorContacts
All Implemented Interfaces:
Associator, Identifiable, JwmaContacts, JwmaContactsImpl, org.exolab.castor.jdo.TimeStampable

public class CastorContacts
extends AbstractIdentifiable
implements JwmaContactsImpl, Associator, org.exolab.castor.jdo.TimeStampable

Class implementing a specialized JwmaContactsImpl for being persisted with the Castor Plugins.

Version:
0.9.7 07/02/2003
Author:
Dieter Wimberger

Field Summary
 
Fields inherited from interface org.exolab.castor.jdo.TimeStampable
NO_TIMESTAMP
 
Constructor Summary
CastorContacts()
           
 
Method Summary
 void addContact(JwmaContactImpl contact)
          Adds a JwmaContactImpl instance to this contact database.
 void addContactCategory(java.lang.String category)
          Adds a contact category to the cached list of categories.
 void addContactGroup(JwmaContactGroupImpl group)
          Adds a JwmaContactGroupImpl instance to this contact database.
 void addFrequentRecipient(JwmaContactImpl contact)
          Adds a frequent recipient JwmaContactImpl instance to this contact database.
 boolean containsContact(java.lang.String uid)
          Tests if this JwmaContactsImpl contains a contact with the given unique identifier.
 boolean containsContactGroup(java.lang.String uid)
          Tests if this JwmaContactsImpl contains a contact group with the given unique identifier.
 boolean containsContactGroupName(java.lang.String name)
          Tests if this JwmaContactsImpl contains a contact group with the given name.
 boolean containsContactWithNickname(java.lang.String nick)
          Tests if the contact database contains a contact with the given nickname.
 JwmaContactImpl createContact()
          Creates and returns a new JwmaContactImpl.
 JwmaContactGroupImpl createContactGroup(java.lang.String name)
          Creates a new JwmaContactGroupImpl with the given name.
 boolean existsContactCategory(java.lang.String category)
          Tests if a given category exists in this JwmaContactsImpl.
 java.lang.String getCategoryFilter()
          Returns the name of the category which is not filtered at the moment.
 JwmaContact getContact(java.lang.String uid)
          Returns an JwmaContact representing the contact with the given unique identifier.
 JwmaContact getContactByNickname(java.lang.String nick)
          Returns contact with given nickname.
 ContactFilter getContactFilter()
          Returns the arbitrary contact filter, which is set for filtering contacts on listing.
 JwmaContactGroup getContactGroup(java.lang.String cuid)
          Returns an JwmaContactGroup representing the contact group with the given unique identifier.
 JwmaContactGroup getContactGroupByName(java.lang.String name)
          Returns an JwmaContactGroupByName representing the contact group with the given name.
 java.util.Collection getContactsCollection()
          Methods for Castor to set/get collections
 java.util.Collection getGroupsCollection()
           
 java.util.Iterator getLastnameStarts()
          Returns an iterator of non-duplicate strings with the first characters of the lastnames of all contacts in this contact database.
 java.util.List getRemovedAssociations()
          Returns the associated instances.
 long jdoGetTimeStamp()
           
 void jdoSetTimeStamp(long timeStamp)
           
 java.lang.String[] listContactCategories()
          Returns an array of available contact categories.
 JwmaContactGroup[] listContactGroups()
          Returns an array of contact groups containing all groups of this contact database.
 JwmaContact[] listContacts()
          Returns an array of contacts containing all contacts in this contact database.
 JwmaContact[] listFrequentRecipients()
          Returns an array of contacts containing all frequent recipient contacts.
 void persistContacts(org.exolab.castor.jdo.Database db)
           
 void removeContact(JwmaContactImpl contact)
          Removes a JwmaContactImpl instance from this contact database.
 void removeContactGroup(JwmaContactGroupImpl group)
          Removes a JwmaContactGroupImpl instance from this contact database.
 void removeFrequentRecipient(JwmaContactImpl contact)
          Removes a frequent recipient JwmaContactImpl instance from this contact database.
 void setCategoryFilter(java.lang.String category)
          Sets a category based contact filter, which will be filtering contacts which are not of the given category on listing.
 void setContactFilter(ContactFilter filter)
          Sets an arbitrary contact filter, which will be filtering contacts on listing.
 void setContactsCollection(java.util.Collection collection)
           
 void setGroupsCollection(java.util.Collection collection)
           
 void updateContacts(org.exolab.castor.jdo.Database db)
           
 
Methods inherited from class dtw.webmail.util.AbstractIdentifiable
equals, getUID, setUID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dtw.webmail.model.JwmaContacts
getUID
 

Constructor Detail

CastorContacts

public CastorContacts()
Method Detail

getContactsCollection

public java.util.Collection getContactsCollection()
Methods for Castor to set/get collections


setContactsCollection

public void setContactsCollection(java.util.Collection collection)

getGroupsCollection

public java.util.Collection getGroupsCollection()

setGroupsCollection

public void setGroupsCollection(java.util.Collection collection)

listContactCategories

public java.lang.String[] listContactCategories()
Description copied from interface: JwmaContacts
Returns an array of available contact categories.

Specified by:
listContactCategories in interface JwmaContacts
Returns:
an array of String's.

addContactCategory

public void addContactCategory(java.lang.String category)
Description copied from interface: JwmaContactsImpl
Adds a contact category to the cached list of categories.

If the category already exists, the method returns immediately.

Specified by:
addContactCategory in interface JwmaContactsImpl
Parameters:
category - the category as String.

existsContactCategory

public boolean existsContactCategory(java.lang.String category)
Description copied from interface: JwmaContactsImpl
Tests if a given category exists in this JwmaContactsImpl.

Specified by:
existsContactCategory in interface JwmaContactsImpl
Parameters:
category - a category to be looked up.
Returns:
true if the category exists, false otherwise.

containsContact

public boolean containsContact(java.lang.String uid)
Description copied from interface: JwmaContactsImpl
Tests if this JwmaContactsImpl contains a contact with the given unique identifier.

Specified by:
containsContact in interface JwmaContactsImpl
Parameters:
uid - a unique identifier of a contact.
Returns:
true if contained, false otherwise.

getContact

public JwmaContact getContact(java.lang.String uid)
Description copied from interface: JwmaContacts
Returns an JwmaContact representing the contact with the given unique identifier.

If the contact database does not contain any contact with the given identifier, it returns null. Otherwise it returns the associated contact.

Specified by:
getContact in interface JwmaContacts
Returns:
the contact associated with the given identifier, or null.

getContactByNickname

public JwmaContact getContactByNickname(java.lang.String nick)
Description copied from interface: JwmaContactsImpl
Returns contact with given nickname.

Specified by:
getContactByNickname in interface JwmaContactsImpl
Parameters:
nick - the nickname as String.
Returns:
the contact.

containsContactWithNickname

public boolean containsContactWithNickname(java.lang.String nick)
Description copied from interface: JwmaContactsImpl
Tests if the contact database contains a contact with the given nickname.

Specified by:
containsContactWithNickname in interface JwmaContactsImpl
Parameters:
nick - the nickname as String.
Returns:
true if contained, false otherwise.

createContact

public JwmaContactImpl createContact()
Description copied from interface: JwmaContactsImpl
Creates and returns a new JwmaContactImpl.

Specified by:
createContact in interface JwmaContactsImpl
Returns:
the newly created JwmaContactImpl instance.

listContacts

public JwmaContact[] listContacts()
Description copied from interface: JwmaContacts
Returns an array of contacts containing all contacts in this contact database.

If this contact database does not contain any contacts, then this method returns an empty array. Otherwise it contains one JwmaContact for each entry in this contact database.

Specified by:
listContacts in interface JwmaContacts
Returns:
an array of JwmaContact's.

addContact

public void addContact(JwmaContactImpl contact)
Description copied from interface: JwmaContactsImpl
Adds a JwmaContactImpl instance to this contact database.

Specified by:
addContact in interface JwmaContactsImpl
Parameters:
contact - the JwmaContactImpl to be added.

removeContact

public void removeContact(JwmaContactImpl contact)
Description copied from interface: JwmaContactsImpl
Removes a JwmaContactImpl instance from this contact database.

Specified by:
removeContact in interface JwmaContactsImpl
Parameters:
contact - the JwmaContactImpl to be removed.

listFrequentRecipients

public JwmaContact[] listFrequentRecipients()
Description copied from interface: JwmaContacts
Returns an array of contacts containing all frequent recipient contacts.

If the contact database does not contain any frequent recipient contacts, then this method returns an empty array. Otherwise it contains one JwmaContact for each entry in this contact database.

Specified by:
listFrequentRecipients in interface JwmaContacts
Returns:
an array of JwmaContact's.

addFrequentRecipient

public void addFrequentRecipient(JwmaContactImpl contact)
Description copied from interface: JwmaContactsImpl
Adds a frequent recipient JwmaContactImpl instance to this contact database.

Specified by:
addFrequentRecipient in interface JwmaContactsImpl
Parameters:
contact - the frequent recipient JwmaContactImpl to be added.

removeFrequentRecipient

public void removeFrequentRecipient(JwmaContactImpl contact)
Description copied from interface: JwmaContactsImpl
Removes a frequent recipient JwmaContactImpl instance from this contact database.

Specified by:
removeFrequentRecipient in interface JwmaContactsImpl
Parameters:
contact - the frequent recipient JwmaContactImpl to be removed.

containsContactGroup

public boolean containsContactGroup(java.lang.String uid)
Description copied from interface: JwmaContactsImpl
Tests if this JwmaContactsImpl contains a contact group with the given unique identifier.

Specified by:
containsContactGroup in interface JwmaContactsImpl
Parameters:
uid - a unique identifier of a contact group.
Returns:
true if contained, false otherwise.

containsContactGroupName

public boolean containsContactGroupName(java.lang.String name)
Description copied from interface: JwmaContactsImpl
Tests if this JwmaContactsImpl contains a contact group with the given name.

Specified by:
containsContactGroupName in interface JwmaContactsImpl
Parameters:
name - the name for a contact group.
Returns:
true if contained, false otherwise.

getContactGroup

public JwmaContactGroup getContactGroup(java.lang.String cuid)
Description copied from interface: JwmaContacts
Returns an JwmaContactGroup representing the contact group with the given unique identifier.

If the contact database does not contain any contact group with the given identifier, it returns null. Otherwise it returns the associated contact group.

Specified by:
getContactGroup in interface JwmaContacts
Returns:
the contact group associated with the given identifier, or null.

getContactGroupByName

public JwmaContactGroup getContactGroupByName(java.lang.String name)
Description copied from interface: JwmaContactsImpl
Returns an JwmaContactGroupByName representing the contact group with the given name.

If the contact database does not contain any contact group with the given name, it returns null. Otherwise it returns the associated contact group.

Specified by:
getContactGroupByName in interface JwmaContactsImpl
Returns:
the contact group associated with the given name, or null.

listContactGroups

public JwmaContactGroup[] listContactGroups()
Description copied from interface: JwmaContacts
Returns an array of contact groups containing all groups of this contact database.

If this contact database does not contain any groups, then this method returns an empty array. Otherwise it contains one JwmaContactGroup for each group entry in this contact database.

Specified by:
listContactGroups in interface JwmaContacts
Returns:
an array of JwmaContactGroup's.

addContactGroup

public void addContactGroup(JwmaContactGroupImpl group)
Description copied from interface: JwmaContactsImpl
Adds a JwmaContactGroupImpl instance to this contact database.

Specified by:
addContactGroup in interface JwmaContactsImpl

removeContactGroup

public void removeContactGroup(JwmaContactGroupImpl group)
Description copied from interface: JwmaContactsImpl
Removes a JwmaContactGroupImpl instance from this contact database.

Specified by:
removeContactGroup in interface JwmaContactsImpl

createContactGroup

public JwmaContactGroupImpl createContactGroup(java.lang.String name)
                                        throws JwmaException
Description copied from interface: JwmaContactsImpl
Creates a new JwmaContactGroupImpl with the given name.

Specified by:
createContactGroup in interface JwmaContactsImpl
Parameters:
name - the name of the new group as String.
Returns:
the newly created JwmaContactGroupImpl instance.
Throws:
JwmaException - if a group with the same name exists already.

setContactFilter

public void setContactFilter(ContactFilter filter)
Description copied from interface: JwmaContactsImpl
Sets an arbitrary contact filter, which will be filtering contacts on listing. Note that this filter is independent from the category filter, filtering proceeds additive (i.e. a contact has to pass both, AND).

Specified by:
setContactFilter in interface JwmaContactsImpl
Parameters:
filter - an arbitrary ContactFilter.

getContactFilter

public ContactFilter getContactFilter()
Description copied from interface: JwmaContactsImpl
Returns the arbitrary contact filter, which is set for filtering contacts on listing.

Specified by:
getContactFilter in interface JwmaContactsImpl
Returns:
the contact filter instance.

setCategoryFilter

public void setCategoryFilter(java.lang.String category)
Description copied from interface: JwmaContactsImpl
Sets a category based contact filter, which will be filtering contacts which are not of the given category on listing. Note that this filter is independent from the arbitrary set filter, filtering proceeds additive (i.e. a contact has to pass both, AND).

Specified by:
setCategoryFilter in interface JwmaContactsImpl
Parameters:
category - the category which should be listed .

getCategoryFilter

public java.lang.String getCategoryFilter()
Description copied from interface: JwmaContactsImpl
Returns the name of the category which is not filtered at the moment.

Specified by:
getCategoryFilter in interface JwmaContactsImpl
Returns:
the category name which is not filtered as String.

getLastnameStarts

public java.util.Iterator getLastnameStarts()
Description copied from interface: JwmaContactsImpl
Returns an iterator of non-duplicate strings with the first characters of the lastnames of all contacts in this contact database.

Specified by:
getLastnameStarts in interface JwmaContactsImpl

getRemovedAssociations

public java.util.List getRemovedAssociations()
Description copied from interface: Associator
Returns the associated instances.

Specified by:
getRemovedAssociations in interface Associator
Returns:
the associated instances as List.

updateContacts

public void updateContacts(org.exolab.castor.jdo.Database db)
                    throws org.exolab.castor.jdo.PersistenceException
org.exolab.castor.jdo.PersistenceException

persistContacts

public void persistContacts(org.exolab.castor.jdo.Database db)
                     throws org.exolab.castor.jdo.PersistenceException
org.exolab.castor.jdo.PersistenceException

jdoGetTimeStamp

public long jdoGetTimeStamp()
Specified by:
jdoGetTimeStamp in interface org.exolab.castor.jdo.TimeStampable

jdoSetTimeStamp

public void jdoSetTimeStamp(long timeStamp)
Specified by:
jdoSetTimeStamp in interface org.exolab.castor.jdo.TimeStampable

Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)