Source Code Cross Referenced for CastorContactGroup.java in  » Web-Mail » Jwma » dtw » webmail » plugin » std » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Mail » Jwma » dtw.webmail.plugin.std 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.plugin.std;
009:
010:        import dtw.webmail.model.JwmaContact;
011:        import dtw.webmail.model.JwmaContactGroupImpl;
012:        import dtw.webmail.model.JwmaContactImpl;
013:        import dtw.webmail.util.AssociatedAbstractIdentifiable;
014:        import dtw.webmail.util.StringUtil;
015:        import org.apache.log4j.Logger;
016:        import org.exolab.castor.jdo.TimeStampable;
017:
018:        import java.util.ArrayList;
019:        import java.util.Collections;
020:        import java.util.Iterator;
021:        import java.util.List;
022:
023:        /**
024:         * Class implementing a specialized <tt>JwmaContactGroupImpl</tt>
025:         * for being persisted with the Castor Plugins.
026:         *
027:         * @author Dieter Wimberger
028:         * @version 0.9.7 07/02/2003
029:         */
030:        public class CastorContactGroup extends AssociatedAbstractIdentifiable
031:                implements  JwmaContactGroupImpl, TimeStampable {
032:
033:            private static Logger log = Logger
034:                    .getLogger(CastorContactGroup.class);
035:
036:            private String m_Name = "";
037:            private String m_Comments = "";
038:            private CastorContacts m_Contacts;
039:            private List m_ContactIDs;
040:            private long m_Timestamp = TimeStampable.NO_TIMESTAMP;
041:
042:            public CastorContactGroup() {
043:                super ();
044:                m_ContactIDs = Collections.synchronizedList(new ArrayList());
045:            }//constructor
046:
047:            public CastorContactGroup(CastorContacts ctdb) {
048:                super ();
049:                m_Contacts = ctdb;
050:                m_ContactIDs = Collections.synchronizedList(new ArrayList());
051:
052:            }//constructor
053:
054:            public CastorContactGroup(CastorContacts ctdb, String name) {
055:                super ();
056:                m_Contacts = ctdb;
057:                m_ContactIDs = Collections.synchronizedList(new ArrayList());
058:                m_Name = name;
059:            }//constructor
060:
061:            public void setContactsDB(CastorContacts contacts) {
062:                m_Contacts = contacts;
063:                //log.debug("Set database: " + contacts.getUID());
064:            }//setContactsDB
065:
066:            public String getName() {
067:                return m_Name;
068:            }//getName
069:
070:            public void setName(String name) {
071:                m_Name = name;
072:            }//setName
073:
074:            public String getComments() {
075:                return m_Comments;
076:            }//getComments
077:
078:            public void setComments(String comments) {
079:                m_Comments = comments;
080:            }//setComments
081:
082:            /**
083:             * Used by castor to get list for persistence.
084:             */
085:            public String getContactIDList() {
086:                String list = StringUtil.join(listContactIDs(), ",");
087:                //log.debug("List of ids=" + list);
088:                return list;
089:                //return StringUtil.joinList(listContactIDs());
090:            }//getContactIDList
091:
092:            /**
093:             * Used by castor to set list from persistent store.
094:             */
095:            public void setContactIDList(String list) {
096:                String[] cont = StringUtil.split(list, ",");
097:                m_ContactIDs.clear();
098:                for (int i = 0; i < cont.length; i++) {
099:                    addContactID(cont[i]);
100:                }
101:            }//setContactIDList
102:
103:            protected void addContactID(String uid) {
104:                m_ContactIDs.add(uid);
105:                //log.debug("Added contact with id=" + uid);
106:            }//addContactID
107:
108:            protected void removeContactID(String uid) {
109:                m_ContactIDs.remove(uid);
110:            }//removeContactID
111:
112:            protected String[] listContactIDs() {
113:                String[] contacts = new String[m_ContactIDs.size()];
114:                return (String[]) m_ContactIDs.toArray(contacts);
115:            }//listContactIDs
116:
117:            public JwmaContact[] listContacts() {
118:                //log.debug("Listing " + m_ContactIDs.size() + " contacts.");
119:                if (m_ContactIDs.size() == 0) {
120:                    return new JwmaContact[0];
121:                }
122:                List list = getContacts();
123:                //log.debug("Retrieved contact references.");
124:                //return the
125:                JwmaContact[] contacts = new JwmaContact[list.size()];
126:                return (JwmaContact[]) list.toArray(contacts);
127:            }//listContacts
128:
129:            public List getContacts() {
130:                ArrayList contacts = new ArrayList(m_ContactIDs.size());
131:                if (m_ContactIDs.size() > 0) {
132:                    for (Iterator iter = m_ContactIDs.iterator(); iter
133:                            .hasNext();) {
134:                        contacts.add(m_Contacts
135:                                .getContact((String) iter.next()));
136:                        //log.debug("getContacts()::Added contact");
137:                    }
138:                }
139:                //return list with references
140:                return contacts;
141:            }//getContacts
142:
143:            public void addContact(JwmaContactImpl con) {
144:                //add uid
145:                addContactID(con.getUID());
146:            }//addContact
147:
148:            public void removeContact(JwmaContactImpl con) {
149:                //remove from uids list
150:                removeContactID(con.getUID());
151:            }//removeContact
152:
153:            public boolean containsContact(String uid) {
154:                return m_ContactIDs.contains(uid);
155:            }//containsContact
156:
157:            public long jdoGetTimeStamp() {
158:                return m_Timestamp;
159:            }//jdoGetTimeStamp
160:
161:            public void jdoSetTimeStamp(long timeStamp) {
162:                m_Timestamp = timeStamp;
163:            }//jdoSetTimeStamp
164:
165:        }//class CastorContactGroup
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.